<p>Hello geeks, I have this code in my app:<br> self.menu_items = (<br> ( "/_Languages", None,None, 0, "<Branch>" ),<br> ( "/Languages/_english", None,self.print_lang, 0, "<CheckItem>" ),<br>
( "/Languages/_german", None,self.print_lang, 0, "<CheckItem>" ),<br> )<br> <br> self.vbox = gtk.VBox(False, 0)<br> self.menubar = self.get_main_menu(self.okno)<br>
self.vbox.pack_start(self.menubar, False, True, 0)<br> self.menubar.show() <br> <br> def get_main_menu(self, window):<br> accel_group = gtk.AccelGroup()<br> item_factory = gtk.ItemFactory(gtk.MenuBar, "<main>", accel_group)<br>
# This method generates the menu items. Pass to the item factory<br> # the list of menu items<br> item_factory.create_items(self.menu_items)<br> # Attach the new accelerator group to the window.<br>
window.add_accel_group(accel_group)<br> # need to keep a reference to item_factory to prevent its destruction<br> self.item_factory = item_factory<br> # Finally, return the actual menu bar created by the item factory.<br>
return item_factory.get_widget("<main>") <br> <br>how to make checkitem menu and allow to be checked only one item? I would like to have english checked but not german at the same time. And when I click on german it should uncheck english. How to make this? </p>
<p>And other question: I am using self.print_lang function and I would like to have something like this ( "/Languages/_english", None,self.print_lang('en'), 0, "<CheckItem>" )<br>but the problem is self.print_lang('en') with parameter 'en' is automatically executed after app run. I can use only self.print_lang without parameter or use callback integer (default-0, or other integers) - but this is not very comfortable. Any advice for this?</p>
<p>many thanks in advance </p>