Python Forum
[WxPython] Why is choicebox not displayed?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[WxPython] Why is choicebox not displayed?
#1
The code:
import wx

showliste = ["item1", "item2", "item3"]

class Mainframe(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title)
        
        self.shopanel = Shopanel(self, id)
        
        vbox = wx.BoxSizer(wx.VERTICAL) 
        vbox.Add(self.shopanel, 0, wx.EXPAND)
        
        self.SetSizer(vbox)

        self.Show()


class Shopanel(wx.Panel):
    def __init__(self, parent, id):
        wx.Panel.__init__(self, parent, id)
        
        self.SetMinSize((100, 100))
        self.SetMaxSize((150, 150))
        
        chos = wx.MultiChoiceDialog(self, "show:", "",
                                     showliste)
        chos.SetSelections(range(len(showliste[:-1])))
        
        hbox = wx.BoxSizer(wx.HORIZONTAL)
        hbox.Add(chos)
        self.SetSizerAndFit(hbox)
        


if __name__ == "__main__": 

    app = wx.App(0)
    Mainframe(None, -1, "Mainframe")  

    app.MainLoop() 
And two questions:
First and more important, why is the choicebox not shown? I simply get an empty window.
Second, how to make SetMinSize and SetMaxSize doing something, in the best case even influencing the panelsize? Actually, they just seem to do... nothing.
Reply


Messages In This Thread
Why is choicebox not displayed? - by merlem - Jan-20-2017, 04:54 PM
RE: Why is choicebox not displayed? - by Yoriz - Jan-20-2017, 07:58 PM
RE: Why is choicebox not displayed? - by merlem - Jan-21-2017, 09:07 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020