Re: Windows / Tkinter - problem with grid - not able to place widgets at desired places
Il Mon, 18 Aug 2008 12:15:10 +0100, dudeja.rajat ha scritto: Hi, I'm learning Python and Tkinter. I've started programming in Eclipse with PyDev. I'm intending to create a GUI. I'm not able to understand the Grid manager perhaps because there is quite a less documentation available for it on the net. My desired GUI is attached in the mail. Although I've tried writing a class module for this GUI but I'm not able to set all things right in the GUI. The Biggest problem seems to be with the Grid Manager in terms how it divides a window in Rows / columns. etc. I'm not able to place none of the widgets correctly in the GUI. For your convenience, I'm attaching this code also as myModule1.py . Please some one review it and help create me this GUI. Uhm, I don't think you should use the grid manager to obtain a window like that. The grid manager is for equally distributing widgets both horizontally and vertically. And I'm not sure that you can realize that window look with Tkinter. You could get close by horizontally packing each widget row in a frame and then vertically packing the frames in the window. But the look will be quite different than your target. If you are not satisfied with that I suggest you move to other toolkits which have more complex geometry managers than .pack and .grid. Ciao - FB -- http://mail.python.org/mailman/listinfo/python-list
Re: Windows / Tkinter - problem with grid - not able to place widgets at desired places
On Sun, Sep 14, 2008 at 7:32 AM, Francesco Bochicchio [EMAIL PROTECTED] wrote: Il Mon, 18 Aug 2008 12:15:10 +0100, dudeja.rajat ha scritto: Hi, I'm learning Python and Tkinter. I've started programming in Eclipse with PyDev. I'm intending to create a GUI. I'm not able to understand the Grid manager perhaps because there is quite a less documentation available for it on the net. My desired GUI is attached in the mail. Although I've tried writing a class module for this GUI but I'm not able to set all things right in the GUI. The Biggest problem seems to be with the Grid Manager in terms how it divides a window in Rows / columns. etc. I'm not able to place none of the widgets correctly in the GUI. For your convenience, I'm attaching this code also as myModule1.py . Please some one review it and help create me this GUI. Uhm, I don't think you should use the grid manager to obtain a window like that. The grid manager is for equally distributing widgets both horizontally and vertically. And I'm not sure that you can realize that window look with Tkinter. Yes you can. You could get close by horizontally packing each widget row in a frame and then vertically packing the frames in the window. But the look will be quite different than your target. If you are not satisfied with that I suggest you move to other toolkits which have more complex geometry managers than .pack and .grid. Uhm.. I'm sure it is more a question of learning how to use them properly. The following code should be very close to the original request, depending on the tk version some minor modifications may be needed. from Tkinter import Tk, Button, Checkbutton, Label, Entry, Frame class App: def __init__(self, master): column0_padx = 24 row_pady = 36 #Label 1 lbl_testcase_exec = Label(master, text=Test case execution, wraplength=100, anchor='w', justify='left') lbl_results_cmp = Label(master, text=Results comparison, wraplength=100, justify='left') lbl_tolerance = Label(master, text=Tolerance (5%), wraplength=100) testcase_exec = Checkbutton(master) results_cmp = Checkbutton(master) tolerance = Entry(master, width=4) lbl_analysis = Label(master, text=Analysis Library) analysis_lib = Entry(master, width=30) lbl_testcase_exec.grid(row=0, column=2, padx=20, pady=12, sticky='w') lbl_results_cmp.grid(row=0, column=3, pady=12, sticky='w') lbl_tolerance.grid(row=0, column=4, padx=20, pady=12, sticky='wn') lbl_analysis.grid(row=1, column=0, sticky='w', padx=column0_padx) analysis_lib.grid(row=1, column=1, sticky='w') testcase_exec.grid(row=1, column=2, padx=20, sticky='w') results_cmp.grid(row=1, column=3, sticky='w') tolerance.grid(row=1, column=4, padx=20, sticky='w') #Label 2 lbl_ref_analysis = Label( master, text=Reference Analysis Libary Version, wraplength=150, justify='left', pady=row_pady) ref_analysis_lib = Entry(master, width=30) lbl_ref_analysis.grid(row=2, column=0, sticky='w', padx=column0_padx) ref_analysis_lib.grid(row=2, column=1, sticky='w') # version lbl_version = Label(master, text=Version under Test) version = Label(master, text=vA.B.C.D) lbl_version.grid(row=3, column=0, sticky='w', padx=column0_padx) version.grid(row=3, column=1, sticky='w') # test all lbl_testall = Label(master, text=Test All) testall = Checkbutton(master) lbl_testall.grid(row=4, column=0, pady=row_pady, padx=column0_padx, sticky='w') testall.grid(row=4, column=1, sticky='w') # buttons bottom_frame = Frame(master) bottom_frame.grid(row=5, column=1, columnspan=3, sticky='w') btn_start = Button(bottom_frame, text = Go, width=7) btn_start.pack(side='left') btn_commit = Button(bottom_frame, text=Commit, width=7) btn_commit.pack(side='left', padx=80) btn_exit = Button(bottom_frame, text=Exit, width=7) btn_exit.pack(side='left') root = Tk() root.title(Test Automation) root.minsize(800, 400) app = App(root) root.mainloop() Ciao - FB -- http://mail.python.org/mailman/listinfo/python-list -- -- Guilherme H. Polo Goncalves -- http://mail.python.org/mailman/listinfo/python-list
Windows / Tkinter - problem with grid - not able to place widgets at desired places
Hi, I'm learning Python and Tkinter. I've started programming in Eclipse with PyDev. I'm intending to create a GUI. I'm not able to understand the Grid manager perhaps because there is quite a less documentation available for it on the net. My desired GUI is attached in the mail. Although I've tried writing a class module for this GUI but I'm not able to set all things right in the GUI. The Biggest problem seems to be with the Grid Manager in terms how it divides a window in Rows / columns. etc. I'm not able to place none of the widgets correctly in the GUI. For your convenience, I'm attaching this code also as myModule1.py . Please some one review it and help create me this GUI. PS: The desired GUI is attached as a GIF file. The version v1.4.5.1 is a label the contents of which are dynamically picked. Thanks and regards, Rajat Guys please help me on this topic. No answers make me suspect if I mailed the query as per the mailing list guidelines. Cheers, rajat attachment: Desired GUI.GIF#Filename:myModule1 #Description: Creates the basic Tkinter programs #Author: Rajat Dudeja #Date:16.08.2008 from Tkinter import * #GUI class class myAppGUI: def __init__(self, master): #Start Test Button self.bStartTest = Button( master, \ text = Start Test, \ command = self.hStartTest, \ ) self.bStartTest.config( justify = CENTER, \ padx = 20, \ width = 10, #pady= 5, \ relief = RAISED ) self.bStartTest.grid( row = 10, \ column = 2, \ columnspan = 1, \ sticky = EW) #Commit Results Button self.bCommitResults = Button( master, \ text = Commit Results, \ command = self.hCommitResults \ ) self.bCommitResults.config( justify = CENTER, \ padx = 20, \ #pady= 5, \ width = 10, \ relief = RAISED ) self.bCommitResults.grid( row = 10, \ column = 5, \ columnspan = 1, \ sticky = EW) #Exit Button self.bExit = Button( master, \ text = Exit, \ command = master.quit ) self.bExit.config( justify = CENTER, \ padx = 20, \ width= 10, \ relief = RAISED, \ ) self.bExit.grid( row = 10, \ column = 8, \ columnspan = 1, \ sticky = EW) #Labels and Drop down menus #Label 1 self.lAnalysisLib = Label( master, \ text = Analysis Library:, \ justify = RIGHT) self.lAnalysisLib.grid(row = 0) #Label 2 self.lRefAnalysisLibVer = Label( master, \ text = Reference Analysis Libary Version:, \ justify = LEFT) self.lRefAnalysisLibVer.config( wraplength = 100 ) self.lRefAnalysisLibVer.grid(row = 5) def hStartTest(self): print 'Starting Test...' def hCommitResults(self): print 'Commiting to SVN...' #End of myAppGUI Class # Main Program myRoot = Tk() myRoot.title(Test Automation) myRoot.minsize(800, 400) myAppGUIObject = myAppGUI(myRoot) myRoot.mainloop()-- http://mail.python.org/mailman/listinfo/python-list
Windows / Tkinter - problem with grid - not able to place widgets at desired places
Hi, I'm learning Python and Tkinter. I've started programming in Eclipse with PyDev. I'm intending to create a GUI. I'm not able to understand the Grid manager perhaps because there is quite a less documentation available for it on the net. My desired GUI is attached in the mail. Although I've tried writing a class module for this GUI but I'm not able to set all things right in the GUI. The Biggest problem seems to be with the Grid Manager in terms how it divides a window in Rows / columns. etc. I'm not able to place none of the widgets correctly in the GUI. For your convenience, I'm attaching this code also as myModule1.py . Please some one review it and help create me this GUI. PS: The desired GUI is attached as a GIF file. The version v1.4.5.1 is a label the contents of which are dynamically picked. Thanks and regards, Rajat attachment: Desired GUI.GIF#Filename:myModule1 #Description: Creates the basic Tkinter programs #Author: Rajat Dudeja #Date:16.08.2008 from Tkinter import * #GUI class class myAppGUI: def __init__(self, master): #Start Test Button self.bStartTest = Button( master, \ text = Start Test, \ command = self.hStartTest, \ ) self.bStartTest.config( justify = CENTER, \ padx = 20, \ width = 10, #pady= 5, \ relief = RAISED ) self.bStartTest.grid( row = 10, \ column = 2, \ columnspan = 1, \ sticky = EW) #Commit Results Button self.bCommitResults = Button( master, \ text = Commit Results, \ command = self.hCommitResults \ ) self.bCommitResults.config( justify = CENTER, \ padx = 20, \ #pady= 5, \ width = 10, \ relief = RAISED ) self.bCommitResults.grid( row = 10, \ column = 5, \ columnspan = 1, \ sticky = EW) #Exit Button self.bExit = Button( master, \ text = Exit, \ command = master.quit ) self.bExit.config( justify = CENTER, \ padx = 20, \ width= 10, \ relief = RAISED, \ ) self.bExit.grid( row = 10, \ column = 8, \ columnspan = 1, \ sticky = EW) #Labels and Drop down menus #Label 1 self.lAnalysisLib = Label( master, \ text = Analysis Library:, \ justify = RIGHT) self.lAnalysisLib.grid(row = 0) #Label 2 self.lRefAnalysisLibVer = Label( master, \ text = Reference Analysis Libary Version:, \ justify = LEFT) self.lRefAnalysisLibVer.config( wraplength = 100 ) self.lRefAnalysisLibVer.grid(row = 5) def hStartTest(self): print 'Starting Test...' def hCommitResults(self): print 'Commiting to SVN...' #End of myAppGUI Class # Main Program myRoot = Tk() myRoot.title(Test Automation) myRoot.minsize(800, 400) myAppGUIObject = myAppGUI(myRoot) myRoot.mainloop()-- http://mail.python.org/mailman/listinfo/python-list