multilanguage application - step by step
Peter Irbizon
peterirbizon at gmail.com
Fri Jul 29 06:16:47 EDT 2011
> Well, it depends on how you're constructing your interface. If you're
> creating all the widgets in Python code, you could move all your
> foo.text = "Bar"; statements to one method that updates the text for all
> widgets, and call that both from the constructor and from the
> language-switching event handler.
Thanks again. I am using pygtk so I should call function to change all text,
labels, etc. (I thought there is simplier solution) But I don't know how to
change texts on menu items. Usually I am using this code to build menus: Any
advice how to refresh menus please?
self.menu_items = (
( "/_Languages", None,None, 0, "<Branch>" ),
( "/Languages/_english", None,self.print_lang, 0, "<CheckItem>"
),
( "/Languages/_german", None,self.print_lang, 0, "<CheckItem>"
),
)
self.vbox = gtk.VBox(False, 0)
self.menubar = self.get_main_menu(self.okno)
self.vbox.pack_start(self.menubar, False, True, 0)
self.menubar.show()
def get_main_menu(self, window):
accel_group = gtk.AccelGroup()
item_factory = gtk.ItemFactory(gtk.MenuBar, "<main>", accel_group)
item_factory.create_items(self.menu_items)
window.add_accel_group(accel_group)
self.item_factory = item_factory
return item_factory.get_widget("<main>")
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110729/9786938a/attachment.html>
More information about the Python-list
mailing list