WxPython, on show() complete frame is selected

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • LDK
    New Member
    • Mar 2008
    • 1

    WxPython, on show() complete frame is selected

    Hello,

    I am a novice inwxPython. I created a Fram with a textcontrol, radiobox and checkbox. On showing the frame, every widget, from static text to button on the bottom, everything is selected... None of the controls work. Can anybody give a tip to solve this problem.

    Thanks,

    Luc
  • jlm699
    Contributor
    • Jul 2007
    • 314

    #2
    Sounds like an initialization problem.. not quite sure what you're experiencing however... can you give us your code that is causing this problem?

    Comment

    • chaosAD
      New Member
      • Feb 2008
      • 9

      #3
      I usually keep a basic template when im developing wxPython GUIs and then add to it accordingly. That way i cant go wrong and my code looks readable

      Code:
      import wx
      
      class MyFrame(wx.Frame):
          def __init__(self):
              wx.Frame.__init__(self, None, wx.ID_ANY, " My Frame ")
      
              panel = MyPanel(self)
              sizerv = wx.BoxSizer(wx.VERTICAL)
              sizerv.Add(panel, 10, wx.EXPAND|wx.ALL, 0)
              self.SetSizerAndFit()
              self.SetSize((600,400))
      
      class MyPanel(wx.Panel):
          def __init__(self, parent):
              wx.Panel.__init__(self, parent, wx.ID_ANY)
      
              # Button and text controls go here
      
      def Main():
          app = wx.PySimpleApp()
          frame = MyFrame()
          frame.Show()
          app.MainLoop()
           
      if __name__ == '__main__':
          Main()

      Comment

      • jlm699
        Contributor
        • Jul 2007
        • 314

        #4
        Originally posted by chaosAD
        Code:
        self.SetSizerAndFit() # doesn't this need the sizer in () ?
        Doesn't that call need the sizer within the () ?

        Comment

        • chaosAD
          New Member
          • Feb 2008
          • 9

          #5
          heh, i was at work when i typed the code up i didnt test it but yeah you're right self.SetSizerAn dFit(sizerv) is the correct way ;p

          Comment

          Working...