[python] dialogy a glade
Rene Kolb
niino na regnet.cz
Úterý Březen 9 19:44:24 CET 2004
> Glade vytvari jeden XML soubor a vsechny samostatna okna jsou
> definovana v tom souboru, vcetne dialogu. Mozna ale ze uz
> tusim, jak na to. Zrejme ten glade soubor budu muset pri
> kazdem otevreni okna budu muset znova parsovat, coz mi teda
> prijde hloupe. No uvidim a napisu.
aha.
ja jsem to pochopil tak, ze si v Glade naklikam zakladni uzivatelske
rozhrani + kazdy dialog zvlast a zvlast ulozim a nasledne si je
programove osetrim. nicmene z teto konstrukce bych usuzoval,
ze si mohu 'sahnout' pro jakykoliv widget v XML strukture:
self.widgets = libglade.GladeXML ('pyglade2.glade', "window1")
a tedy i pro window2,moje_wokno, ...
potvrzuje to snad napr. i tento clanek (dole)
http://www.linuxjournal.com/article.php?sid=4702
/citate
Note that you can supply the name of any widget in the hierarchy, even if it's
buried deeply within a top-level window. This makes it possible to partition
complex visual hierarchies--for example, the pages of a complex
notebook-based interface--across multiple Glade project files. It also makes
it easy to handle projects with dynamic visual content, loading only the
components that are appropriate at any given time.
Once you have loaded a widget hierarchy, GladeXML lets you look up specific
widgets by name via the get_widget method. get_widget returns the widget you
requested or ``None'' if the widget cannot be found:
window1 = loader.get_widget("window1")
if window1:
window1.set_title("Hello, World!")
/
nebo sem mimon
r
Další informace o konferenci Python