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

Reply via email to