[pygtk] NEWBIE QUESTION: Simple spinbutton example?

Darren Enns darethehair at gmail.com
Sun Mar 23 21:05:27 WST 2008


Neil Dugan wrote:
> Hello Dare,
>
> Here is one way, that works.  The main problem with the way you had 
> the code structured, is that the 'value' variable in get_spin() and 
> the 'value' variable in main() where two different things.
>
> Separating the two windows into separate classes, makes it is easy to 
> make sure that there is only one 'value' variable.  And the code 
> becomes easier to understand.  As in the main window class it is 
> obvious (see print_value()) that we are refereing to the variable set 
> by the spin_window() class.
>
> Hope this helps.
>
> Neil.
Much thanks to you Neil!  This should put me 'back on track' with my 
code!  I had already spent a long time scouring with Google to find 
examples of 'spinbutton' that were easy enough for me to understand.  I 
had been confident that I could easily 'pick up' a new language like 
Python (and PyGTK) -- especially with all the resources on the Net -- 
but it has been more difficult than I imagined.  Now that I have 
discovered this mailing list, hopefully I will not 'spin my wheels' so 
much before asking for help! :)

Dare


More information about the pygtk mailing list