PyGTK Classes Problems

Tom Grove thomas.grove at nepinc.com
Fri Jul 21 14:54:12 EDT 2006


I can't seem to get a function to continue after I call another gtk 
window class.  Basically I need to grab a date from a calendar in one 
windows and insert that value into an entry box on the calling window.

Calling Window:
import winCal

def getDate(self, widget):
    cimsCal.winCal.dateSelected = 
"DATE"                                                       
    
cimsCal.winCal()                                                                            

    print 
"TEST"                                                                                

    self.wTree.get_widget("entDate").set_text(cimsCal.winCal.dateSelected)

WinCal Class:
#!/usr/bin/env python

import 
sys                                                                                          

import 
pygtk                                                                                        

import 
gtk                                                                                          

import 
gtk.glade                                                                                    

                                                                                                    

# Create a class which is the actual program to be 
run                                             
class 
winCal(gtk.Window):                                                                           

    # 
Globals                                                                                       

    dateSelected = 
""                                                                               

                                                                                                    

    # This is where we hook in our glade file and connect to the gui 
stuff                         
    def 
__init__(self):                                                                             

        gladefile = 
"cimsGui/cimsgui.glade"                                                         

        self.windowname = 
"winCal"                                                                 
        self.wTree = gtk.glade.XML(gladefile, 
self.windowname)                                     
                                                                                                    

        # Create a dictionary of function 
calls                                                    
        dic = { "on_calendar1_day_selected_double_click" : 
self.giveDate                           
        
}                                                                                           

                                                                                                    

        
self.wTree.signal_autoconnect(dic)                                                          

                                                                                                    

        
gtk.main()                                                                                  

                                                                                                    

    # Start 
Functions                                                                               

    def giveDate(self, 
widget):                                                                     

        self.dateSelected = 
self.wTree.get_widget("calendar1").get_date()                          
        
self.wTree.get_widget("winCal").destroy()                                                   

                                                                                                    

if __name__ == 
'__main__':                                                                          

    app = winCal()

After I do this cimsCal.winCal() the print "TEST" never happens.  What 
am I doing wrong.  

-- 
Tom Grove




More information about the Python-list mailing list