how to make checkitem menu and allow to be checked only one item?

Peter Irbizon peterirbizon at
Fri Jul 29 11:43:42 CEST 2011

Hello geeks, I have this code in my app:
        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)

    def get_main_menu(self, window):
        accel_group = gtk.AccelGroup()
        item_factory = gtk.ItemFactory(gtk.MenuBar, "<main>", accel_group)
          # This method generates the menu items. Pass to the item factory
          #  the list of menu items
          # Attach the new accelerator group to the window.
          # need to keep a reference to item_factory to prevent its
        self.item_factory = item_factory
          # Finally, return the actual menu bar created by the item factory.
        return item_factory.get_widget("<main>")

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?

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>" )
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?

many thanks in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list