Sunday, 15 August 2010

wxpython - Scrolling in a GUI Panel? -


After

Here is the general layout of my GUI:

  || Title ||||| |||||||||||||||| X | | | Words | | | Blah | | . . . . | | | | | | . | | | | BTN | |||||||||||||||||||||||||||||||  

In fact, there are two large mirrors, the one on which the shape changes, how big a window is, and the right ones which remain constant. I want to include some interactive widgets in the right panel, such as check boxes, radio buttons, etc., but the number of things I want to put in may be bigger than the size of the whole application. I think the panel wants to be scrollable in wxPython (or equivalent wxWidgets), how would I go about it? Here's my guess:

  class MyGUI (wx.Frame): def __init __ (self) wx.Frame (none, -1) main_panel = wx.panel (self, -1) Main_sizer = wx .BoxSizer (wx.HORIZONTAL) main_panel.SetSizer (main_sizer) left_panel = wx.panel (main_panel, -1) main_sizer.Add (left_panel, 1, wx.EXPAND) right_panel = wx.panel (main_panel, -1) Right_sizer = wx (Box_sizer) main_sizer.Add (right_panel, 0, wx.EXPAND) for category (100): right_sizer.Add (wx.CheckBox (right_panel, -1, "Happy Box"), 0, wx. EXPAND) right_sizer.Add (wx.Button (right_panel, -1, "go!"), 1, wx.EXPAND) right_panel.fit () main_panel.Fit () self.Layout () auto Now I know that wxPython has a nifty little panel called scroll panel, but for one reason or another reason it does not really recognize how big is the panel on the right; Which is to say, if I change the shape of the GUI, the scrollbar does not correct themselves. In fact, they are not even right in the first place. How can I say this intelligently? 

wxScrolledWindow Probably what you are looking for I have many problems with wxWidgets and widgets Dynamically vary, but what you want to do is probably change the size of the widget inside wxScrolledWindow, and then call FitInside () on the scrolled window.


No comments:

Post a Comment