change the language of a menubar

Hi Guys,

i am new to wxpython an i have trouble with the menubar.
i tried to write a dynamic menubar that can read the itemnames from an
sqlite3 database, so i can change the language very easy.
like this.

def MakeMenuBar(self):
    self.dbCursor.execute("SELECT " + self.lang[self.langSelect] +"
FROM menu")
    self.menuwords = self.dbCursor.fetchall()
    menu = wx.Menu() ##Filemenu
    item = menu.Append(ID_CONNECT, "%s" %self.menuwords[3])
    .
    .
    .

this works fine, when i draw the menu for the first time, when i want
to change language in runtime, i can not get the menu to redraw.
can someone help me out on this one?
thanks
hendryk

hendryk wrote:

Hi Guys,

i am new to wxpython an i have trouble with the menubar.
i tried to write a dynamic menubar that can read the itemnames from an
sqlite3 database, so i can change the language very easy.
like this.

def MakeMenuBar(self):
    self.dbCursor.execute("SELECT " + self.lang[self.langSelect] +"
FROM menu")
    self.menuwords = self.dbCursor.fetchall()
    menu = wx.Menu() ##Filemenu
    item = menu.Append(ID_CONNECT, "%s" %self.menuwords[3])
    .

this works fine, when i draw the menu for the first time, when i want
to change language in runtime, i can not get the menu to redraw.
can someone help me out on this one?

The easiest thing to do is to just create a new instance of the menubar and menus and then replace the existing one with frame.SetMenuBar(newMenuBar)

···

--
Robin Dunn
Software Craftsman

thanks a million, mate.

···

On 5 Jun., 21:58, Robin Dunn <ro...@alldunn.com> wrote:

hendryk wrote:
> Hi Guys,

> i am new to wxpython an i have trouble with the menubar.
> i tried to write a dynamic menubar that can read the itemnames from an
> sqlite3 database, so i can change the language very easy.
> like this.

> def MakeMenuBar(self):
> self.dbCursor.execute("SELECT " + self.lang[self.langSelect] +"
> FROM menu")
> self.menuwords = self.dbCursor.fetchall()
> menu = wx.Menu() ##Filemenu
> item = menu.Append(ID_CONNECT, "%s" %self.menuwords[3])
> .
> .
> .

> this works fine, when i draw the menu for the first time, when i want
> to change language in runtime, i can not get the menu to redraw.
> can someone help me out on this one?

The easiest thing to do is to just create a new instance of the menubar
and menus and then replace the existing one with
frame.SetMenuBar(newMenuBar)

--
Robin Dunn
Software Craftsmanhttp://wxPython.org