[Tutor] Tkinter: Can's figure out how to put a frame in a second window
Hi. running Linux, with python3.6 I am trying to learn how to put a frame on a second window. I get no errors showing in the terminal, and I get no traceback. What is happening is that the contents of the frame appear in the master window. I was expecting them to show in the second window. Also I expected the frame to be sunken, but there is no obvious signs of the frame, not even a colored background. What am I doing wrong? Thank you, Chris Roy-Smith here is my code: #! /usr/bin/python3 from tkinter import * def NewWindow(): sw=Toplevel(master) sw.title('New Window') Label(sw, text='new window').grid(row=0, column=0) sframe=Frame(sw, relief=SUNKEN, bg='red').grid(row=1, column=0) Label(sframe, text='Label in a frame').grid(row=2, column=0) Label(sframe, text='Second label in this frame').grid(row=3, column=0) Button(sw, text='close window', command=sw.destroy).grid(row=5, column=0) master=Tk() master.title('Master Window') Button(master, text='open window', command=NewWindow).grid(row=1, column=1) Button(master, text='quit', command=master.destroy).grid(row=2, column=1) Label(master, text="learning").grid(row=0, column=0) master.mainloop() ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Tkinter: Can's figure out how to put a frame in a second window
On 09/03/2019 02:53, Chris Roy-Smith wrote: > What is happening is that the contents of the frame appear in the master > window. I was expecting them to show in the second window. Also I > expected the frame to be sunken, but there is no obvious signs of the > frame, not even a colored background. > > What am I doing wrong? Its a very common mistake in Tkinter. When you use one of the layout managers, in this case grid() the return value is always None. > def NewWindow(): > sw=Toplevel(master) > sw.title('New Window') > Label(sw, text='new window').grid(row=0, column=0) > sframe=Frame(sw, relief=SUNKEN, bg='red').grid(row=1, column=0) So you are here assigning None to sframe. > Label(sframe, text='Label in a frame').grid(row=2, column=0) > Label(sframe, text='Second label in this frame').grid(row=3, column=0) And when you pass None as the parent to a widget Tk defaults to the root. So your widgets appear in your main window. Change the sframe line to two lines: sframe=Frame(sw, relief=SUNKEN, bg='red') sframe.grid(row=1, column=0) and all will be well except the sunken relief wont work. TYhats because the sunken form requires a border width of at least 2 pixels to be visible. So you need to add border=2 (or more) to make it work. So the final line should be: sframe=Frame(sw, border=2, relief=SUNKEN, bg='red') sframe.grid(row=1, column=0) As I say its a very common mistake and so, any time weird things happen, always check that anywhere you assign a widget to a variable you call the layout manager on a separate line. HTH -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
[Tutor] How to create a structure from a Log file
Hi All , I would like to know , how can I approach this problem to create a easy structure from the logfile using python so I can review the logfiles quite efficiently . Please share suggestion tip or already written codes. Thanks, ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How to create a structure from a Log file
Would you give us more information? What is an example of a log file? How would you like to see it presented? The more information you give us the easier it is for us to help. On Mar 9, 2019 11:20 AM, "Asad" wrote: Hi All , I would like to know , how can I approach this problem to create a easy structure from the logfile using python so I can review the logfiles quite efficiently . Please share suggestion tip or already written codes. Thanks, ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How to create a structure from a Log file
On 09/03/2019 13:08, Asad wrote: >I would like to know , how can I approach this problem to create > a easy structure from the logfile using python so I can review the logfiles > quite efficiently . Please share suggestion tip or already written codes. That depends on several things: 1) What is the format of the log file? 2) what data does it contain 3) what data do you need to see and organised by what criteria? 4) What do you mean by efficiency? - Speed of processing the logfile? - Speed of writing the reports? - Speed of generating the reports? The OS and Python version would be useful too. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How to create a structure from a Log file
On March 9, 2019 6:08:03 AM MST, Asad wrote: >Hi All , > > I would like to know , how can I approach this problem to create >a easy structure from the logfile using python so I can review the >logfiles >quite efficiently . Please share suggestion tip or already written >codes. > > > >Thanks, >___ >Tutor maillist - Tutor@python.org >To unsubscribe or change subscription options: >https://mail.python.org/mailman/listinfo/tutor The great things about logfiles is they're (typically) all text, and they have regular, prredictable contents. Before you can do anything useful, though, you have to figure out the pattern of the contents. That can vary wildly... in a system logfile there may be many programs that contribute so the patterns can take more work to figure out; if it's a logfile for one specific program, it may be easier. What kinds of things are you looking for? What kind of data are you expecting? You should be able to find lots of examples of logfile processing on the internet, but whether any of that is of any use to you beyond providing a model for techniques is up to whether your logfile is like any of the ones being processed in those examples. As in other replies - tell us more. Also, just a general comment, this list usually works out better if you have more specific questions (I tried AAA and instead of giving me BBB I got CCC), -- Sent from a mobile device with K-9 Mail. Please excuse my brevity. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How to create a structure from a Log file
Hi All , Please a sample logfile [main] [ 2019-01-21 10:13:14.041 CET ] [AssistantLogHandler.configureLogging:176] Begin tracing.. INFO: Jan 21, 2019 10:13:14 AM oracle.assistants.dbua.driver.UpgradeDriver configureLogging INFO: Loading upgrade driver, DBUA running in mode : NONE DBUA running on platform : Linux [main] [ 2019-01-21 10:13:14.237 CET ] [ClusterVerification.getInstance:553] Method Entry. workDir=/tmp frameworkHome=/u01/app/oracle/product/12.2.0.1/dbhome_1 [main] [ 2019-01-21 10:13:14.289 CET ] [CVUVariables.initialize:1456] Start parse all variables from variables.xml... [main] [ 2019-01-21 10:13:14.304 CET ] [VerificationUtil.getVariablesXmlURI:10687] XML variables file: file:/u01/app/oracle/product/12.2.0.1/dbhome_1/cv/cvdata/variables.xml [main] [ 2019-01-21 10:13:14.305 CET ] [VerificationUtil.getVariablesXmlSchemaURI:10669] XML variables schema file: file:/u01/app/oracle/product/ 12.2.0.1/dbhome_1/cv/cvdata/variables.xsd [main] [ 2019-01-21 10:13:14.305 CET ] [CVUVariables.getRootElement:1721] URIs obtained :xsd URI = file:/u01/app/oracle/product/ 12.2.0.1/dbhome_1/cv/cvdata/variables.xsd [main] [ 2019-01-21 10:13:14.306 CET ] [CVUVariables.getRootElement:1722] URIs obtained :xml URI = file:/u01/app/oracle/product/ 12.2.0.1/dbhome_1/cv/cvdata/variables.xml [main] [ 2019-01-21 10:13:14.306 CET ] [CVUVariables.getRootElement:1735] xsdFile exists : file:/u01/app/oracle/product/ 12.2.0.1/dbhome_1/cv/cvdata/variables.xsd [main] [ 2019-01-21 10:13:14.307 CET ] [CVUVariables.getRootElement:1750] xmlFile exists : file:/u01/app/oracle/product/ 12.2.0.1/dbhome_1/cv/cvdata/variables.xml [main] [ 2019-01-21 10:13:14.307 CET ] [CVUVariables.getRootElement:1763] setting xmlFactory to use xsdFile : file:/u01/app/oracle/product/ 12.2.0.1/dbhome_1/cv/cvdata/variables.xsd [main] [ 2019-01-21 10:13:14.408 CET ] [CVUVariables.getRootElement:1794] The xml variables file: file:/u01/app/oracle/product/ 12.2.0.1/dbhome_1/cv/cvdata/variables.xml, was parsed correctly [main] [ 2019-01-21 10:13:14.410 CET ] [CVUVariables.parse:1521] Version found ALL [main] [ 2019-01-21 10:13:14.411 CET ] [CVUVariables.parse:1524] Process common variables [main] [ 2019-01-21 10:13:14.415 CET ] [CVUVariableData.:98] CVUVariableData created with names: "s_silent,SILENT" [main] [ 2019-01-21 10:13:14.416 CET ] [CVUVariables.parse:1521] Version found 12.2 [main] [ 2019-01-21 10:13:14.416 CET ] [CVUVariables.parse:1529] Process variables for the release: 12.2 [main] [ 2019-01-21 10:13:14.418 CET ] [CVUVariableData.:98] CVUVariableData created with names: I was thinking to convert it in a excel format or any other format which better viewable Thanks, ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Tkinter: Can's figure out how to put a frame in a second window
On 9/3/19 10:13 pm, Alan Gauld via Tutor wrote: On 09/03/2019 02:53, Chris Roy-Smith wrote: What is happening is that the contents of the frame appear in the master window. I was expecting them to show in the second window. Also I expected the frame to be sunken, but there is no obvious signs of the frame, not even a colored background. What am I doing wrong? Its a very common mistake in Tkinter. When you use one of the layout managers, in this case grid() the return value is always None. def NewWindow(): sw=Toplevel(master) sw.title('New Window') Label(sw, text='new window').grid(row=0, column=0) sframe=Frame(sw, relief=SUNKEN, bg='red').grid(row=1, column=0) So you are here assigning None to sframe. Label(sframe, text='Label in a frame').grid(row=2, column=0) Label(sframe, text='Second label in this frame').grid(row=3, column=0) And when you pass None as the parent to a widget Tk defaults to the root. So your widgets appear in your main window. Change the sframe line to two lines: sframe=Frame(sw, relief=SUNKEN, bg='red') sframe.grid(row=1, column=0) and all will be well except the sunken relief wont work. TYhats because the sunken form requires a border width of at least 2 pixels to be visible. So you need to add border=2 (or more) to make it work. So the final line should be: sframe=Frame(sw, border=2, relief=SUNKEN, bg='red') sframe.grid(row=1, column=0) As I say its a very common mistake and so, any time weird things happen, always check that anywhere you assign a widget to a variable you call the layout manager on a separate line. HTH Thanks Alan, Simple when you know. I remember having a similar issue with Entry widgets, Regards, Chris Roy-Smith ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] How to create a structure from a Log file
On 09/03/2019 18:44, Asad wrote: Hi All , Please a sample logfile [main] [ 2019-01-21 10:13:14.041 CET ] [AssistantLogHandler.configureLogging:176] Begin tracing.. INFO: Jan 21, 2019 10:13:14 AM oracle.assistants.dbua.driver.UpgradeDriver configureLogging INFO: Loading upgrade driver, DBUA running in mode : NONE DBUA running on platform : Linux [main] [ 2019-01-21 10:13:14.237 CET ] [ClusterVerification.getInstance:553] Method Entry. workDir=/tmp frameworkHome=/u01/app/oracle/product/12.2.0.1/dbhome_1 [main] [ 2019-01-21 10:13:14.289 CET ] [CVUVariables.initialize:1456] Start parse all variables from variables.xml... [main] [ 2019-01-21 10:13:14.304 CET ] [VerificationUtil.getVariablesXmlURI:10687] XML variables file: file:/u01/app/oracle/product/12.2.0.1/dbhome_1/cv/cvdata/variables.xml [main] [ 2019-01-21 10:13:14.305 CET ] [VerificationUtil.getVariablesXmlSchemaURI:10669] XML variables schema file: file:/u01/app/oracle/product/ 12.2.0.1/dbhome_1/cv/cvdata/variables.xsd [main] [ 2019-01-21 10:13:14.305 CET ] [CVUVariables.getRootElement:1721] URIs obtained :xsd URI = file:/u01/app/oracle/product/ 12.2.0.1/dbhome_1/cv/cvdata/variables.xsd [main] [ 2019-01-21 10:13:14.306 CET ] [CVUVariables.getRootElement:1722] URIs obtained :xml URI = file:/u01/app/oracle/product/ 12.2.0.1/dbhome_1/cv/cvdata/variables.xml [main] [ 2019-01-21 10:13:14.306 CET ] [CVUVariables.getRootElement:1735] xsdFile exists : file:/u01/app/oracle/product/ 12.2.0.1/dbhome_1/cv/cvdata/variables.xsd [main] [ 2019-01-21 10:13:14.307 CET ] [CVUVariables.getRootElement:1750] xmlFile exists : file:/u01/app/oracle/product/ 12.2.0.1/dbhome_1/cv/cvdata/variables.xml [main] [ 2019-01-21 10:13:14.307 CET ] [CVUVariables.getRootElement:1763] setting xmlFactory to use xsdFile : file:/u01/app/oracle/product/ 12.2.0.1/dbhome_1/cv/cvdata/variables.xsd [main] [ 2019-01-21 10:13:14.408 CET ] [CVUVariables.getRootElement:1794] The xml variables file: file:/u01/app/oracle/product/ 12.2.0.1/dbhome_1/cv/cvdata/variables.xml, was parsed correctly [main] [ 2019-01-21 10:13:14.410 CET ] [CVUVariables.parse:1521] Version found ALL [main] [ 2019-01-21 10:13:14.411 CET ] [CVUVariables.parse:1524] Process common variables [main] [ 2019-01-21 10:13:14.415 CET ] [CVUVariableData.:98] CVUVariableData created with names: "s_silent,SILENT" [main] [ 2019-01-21 10:13:14.416 CET ] [CVUVariables.parse:1521] Version found 12.2 [main] [ 2019-01-21 10:13:14.416 CET ] [CVUVariables.parse:1529] Process variables for the release: 12.2 [main] [ 2019-01-21 10:13:14.418 CET ] [CVUVariableData.:98] CVUVariableData created with names: I was thinking to convert it in a excel format or any other format which better viewable Thanks, I suggest that you start with this https://docs.python.org/3/library/stdtypes.html#string-methods to grab your data. Then how about https://docs.python.org/3/library/csv.html for writing your data. Should this not be adequate please let us know and we'll get you sorted :) -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our language. Mark Lawrence ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor