Python GUI questions

Rick Johnson rantingrickjohnson at gmail.com
Tue Mar 19 23:06:31 EDT 2013


On Tuesday, March 19, 2013 9:36:28 PM UTC-5, maiden129 wrote:

> So should I redo my other code that I created with
> the radioButtons to change the colors of a text?

I believe so. Although you really should explain what your trying to achieve with this code. There is nothing wrong with wrapping some widgets into a single reusable class, however, your examples look more like more "using a hammer to drive screws".

For instance, you have two classes named "button" and "word" (psst: those identifiers should start with a capitol letter BTW!) which are basically two independent Tkinter root windows (even though they don't inherit from Tkinter.Tk). 

"Tkinter.Tk" is meant to be used as the first window, from there you can add as many sub-frames, sub-widgets, or even sub-windows (instances of Tkinter.Toplevel) as you want. 

If you want more than one window, for your GUI application, then instance as many "Tkinter.Toplevel" windows as you like AFTER you create the ONE AND ONLY Tkinter.Tk window.

If however you want to "group" a number of widgets inside a single window, then use the "Tkinter.Frame" to hold them.



More information about the Python-list mailing list