I managed to add a wx.Choice to a status bar by making the Choice its child, and theoretically it does display in the right area:
The problems:
So as you can guess, my objective here is to align the Choice item on the right-side of the window, and to make sure that the status bar's text pane respects the Choice's presence.
import wx
class MainFrame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title='Statusbar',size=(300,200))
panel = wx.Panel(self)
status_btn = wx.Button(panel, label='Get Statusbar Info')
status_btn.Bind(wx.EVT_BUTTON, self.on_status)
self.statusbar = self.CreateStatusBar(2)
w1 = self.statusbar.Size[0]
w1= w1 - 50
self.statusbar.SetStatusWidths([w1, -1])
self.statusbar.SetMinHeight(30)
self.statusbar.SetStatusText('Statusbar field 1')
self.mychoices = wx.Choice(self.statusbar, wx.ID_ANY, choices=[("en"), ("it"), ("de")])
self.mychoices.SetSelection(0)
self.mychoices.SetPosition((w1+2, 2))
self.Show()
def on_status(self, event):
print (self.statusbar.GetStatusText())
print (self.mychoices.GetSelection())
print (self.mychoices.GetString(self.mychoices.GetSelection()))
if __name__ == '__main__':
app = wx.App()
frame = MainFrame()
app.MainLoop()