From: Eric P. <pe...@cg...> - 2004-07-16 00:15:21
|
A common error, bites me often. If what you had were self.ftr_count_btns = Pmw.ButtonBox(...args...) things would work, but what you have is self.ftr_count_btns = Pmw.ButtonBox(...args...).pack(...pack args...) pack() returns None. --Eric On Thursday, July 15, 2004, at 05:03 PM, Faulconer, Steven M. wrote: > Hello everyone, > > I've been tasked to build some graphical interfaces for some command > line > applications we use in our office. The programs are going to run on > both > Windows and Solaris boxes. So far, I've been using Pmw (and Tkinker, of > course) to build my applications. Everything has been working great > until I > got a little bit more complicated. In essence, I'm creating a new > window > with a couple Groups that will contain some labels and buttons. The > issue > that comes up is in the code listed below, followed by the error > message. > > I've gotten the same message when creating solitary Buttons and > attempting > to bind a callback to the button. I'm sure it is something I'm doing. > Note, > this is not the main class of the application, but a second class to > handle > the newly created window (hence the Toplevel call ). > > I edited the code and added a print statement to print the type of > ftr_count_btns, and sure enough, it spits out 'NoneType'. Not sure > what I > did, but any help would be greatly appreciated. > > Thanks. > > Steven Faulconer > > ------- CODE --------- > class CheckerApp: > def __init__( self, parent, project, database ): > self.newroot = Tkinter.Toplevel() > self.newroot.geometry( "250x400" ) > self.newroot.resizable( width = False, height = False ) > self.newroot.option_add( "*Font", "Arial 12" ) > self.newroot.title( "Checker Front End" ) > self.newroot.focus_set() > > # Information Group > self.info_group = Pmw.Group( self.newroot, tag_text = > "Information" > ) > self.info_group.pack( pady = 2, padx = 2, expand = 'yes', fill > = > 'both' ) > proj = Tkinter.Label( self.info_group.interior(), > text = "Project : " + project ).pack( anchor = > Tkinter.W ) > data = Tkinter.Label( self.info_group.interior(), > text = "Database : " + database ).pack( anchor = > Tkinter.W ) > > # Feature Count Group > self.ftr_count_group = Pmw.Group( self.newroot, tag_text = > "Feature > Counter" ) > self.ftr_count_group.pack( pady = 2, padx = 2, expand = 'yes', > fill > = 'both' ) > self.ftr_count_btns = Pmw.ButtonBox( > self.ftr_count_group.interior() > ).pack( fill = 'both', > > expand = 'yes', > > padx = 5, > > pady = 5 ) > self.ftr_count_btns.add( 'Run Checker', command = > self.RunFtrCount ) > self.ftr_count_btns.add( 'View Report', command = > self.ViewFtrCountReport ) > > ------- CODE --------- > > ------- ERROR --------- > Error: 1 > AttributeError Exception in Tk callback > Function: <bound method MainApp.DBSelectButton of <__main__.MainApp > instance at 0x009B2D28>> (type: <type 'instancemethod'>) > Args: (<Tkinter.Event instance at 0x012CDE68>,) > Event type: ButtonPress (type num: 4) > Traceback (innermost last): > File "C:\Python23\Lib\site-packages\Pmw\Pmw_1_2\lib\PmwBase.py", line > 1747, in __call__ > return apply(self.func, args) > File "C:\MyStuff\Software\3DC\GUI\main.py", line 133, in > DBSelectButton > checkerwindow = CheckerApp( self.myparent, self.projmenu.get(), > self.dblist.getvalue()[ 0 ] ) > File "C:\MyStuff\Software\3DC\GUI\main.py", line 36, in __init__ > self.ftr_count_btns.add( 'Run Checker', command = self.RunFtrCount > ) > AttributeError: 'NoneType' object has no attribute 'add' > > ================================================ > Event contents: > char: ?? > delta: 0 > height: ?? > keycode: ?? > keysym: ?? > keysym_num: ?? > num: 1 > send_event: False > serial: 181 > state: 8 > time: 41008750 > type: 4 > widget: .19717176 > width: ?? > x: 67 > x_root: 368 > y: 20 > y_root: 411 > ------- ERROR --------- > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click > _______________________________________________ > Pmw-general mailing list > Pmw...@li... > https://lists.sourceforge.net/lists/listinfo/pmw-general |