I suggest you to start using a framework, pygtkmvc has a really good introduction to "design principles" applied to pygtk. Also kiwi <http://www.async.com.br/projects/kiwi/howto/> is a good one ( for me is better to use) but the pygtkmvc's documentation<http://pygtkmvc.sourceforge.net/docs/quickstart/index.html>is the best.
Once you've an Idea on how you can design your application you can apply also other solutions over "signals" and the frameworks. Good work! 2009/9/15 Doug Brewer <[email protected]> > Hmm. So if I kept everything in one big messy class, I wouldn't need to > worry about how windows communicate with each other, because they'd all have > access to the same methods. But if I want it to be neat and separate, I need > to use signals to communicate between windows? That added layer of > complexity might drive me back to messiness for now. > > But thanks for this input, and I assume this is the path I'd take to > implement it? > > http://faq.pygtk.org/index.py?req=show&file=faq03.009.htp > > > On Mon, Sep 14, 2009 at 9:24 PM, Jeffrey Barish <[email protected] > > wrote: > >> Doug Brewer wrote: >> >> > Hello all, >> > >> > I am a beginner both in python and pygtk. I have an application I am >> > developing as a learning experience. It has multiple windows. Let's say >> > it's a main window and a selection window with a list of items in it, >> each >> > with their own ID. The code started getting big so I split it into two >> > classes, one for each window. Each window has its own glade file as >> well. >> > This seemed nice and clean but I am having problems understanding how >> > these separate classes interact. >> > >> > When the user selects the menu item, the main window class loads the >> pref >> > window and shows it. The user selects an item, and the window closes. >> But >> > here is where I got stuck. I could not figure out how to return the >> > selected value from the "child" window. The window has access to the >> > methods in the preferences class, but not the main class. The main class >> > can access the preference class functions, but doesn't know when the >> item >> > has been selected or the window closed. >> >> When you create separate classes for different parts of your GUI, you are >> essentially creating widgets. Subclass gobject. gobject provides means >> for >> sending signals from one widget to another (connect). There was a >> tutorial >> for this technique at: >> >> http://www.sicem.biz/personal/lgs/docs/gobject-python/gobject- >> tutorial.html#d0e570<http://www.sicem.biz/personal/lgs/docs/gobject-python/gobject-%0Atutorial.html#d0e570> >> >> I'm getting an error message when I try to connect now, but maybe it will >> come back. Also check the pygtk FAQ: >> >> http://faq.pygtk.org/index.py?req=index >> >> You should also understand the MVC pattern. The easiest way to learn it >> is >> to use a framework that supports it. I recommend pygtkmvc: >> >> http://pygtkmvc.sourceforge.net/pub/docs/tutorial/tutorial.html >> >> I use MVC mostly. I create widgets only when I have an element that I >> want >> to reuse in several places in the GUI. >> -- >> Jeffrey Barish >> >> >> _______________________________________________ >> pygtk mailing list [email protected] >> http://www.daa.com.au/mailman/listinfo/pygtk >> Read the PyGTK FAQ: http://faq.pygtk.org/ >> > > > _______________________________________________ > pygtk mailing list [email protected] > http://www.daa.com.au/mailman/listinfo/pygtk > Read the PyGTK FAQ: http://faq.pygtk.org/ >
_______________________________________________ pygtk mailing list [email protected] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
