2

scrollingwindow as main frame for the application is not supported yet for pythoncard. how can i add scrollbars to main frame(background)?

sykora
  • 96,888
  • 11
  • 64
  • 71
altunyurt
  • 2,821
  • 3
  • 38
  • 53

1 Answers1

2

Ive never used pythoncard but in pure wxpython you can just put a ScrolledWindow inside the frame, then use a sizer to controll the scrollbars (asumming the contents of the sizer dont fit in the window). Eg this short code snipit will give you a window with a vertical scrollbar.

class Scrolled(wx.ScrolledWindow):
    def __init__(self, parent):
        wx.ScrolledWindow.__init__(self, parent, size=(200,200))
        self.SetScrollRate(0, 10);
        sizerV = wx.BoxSizer(wx.VERTICAL)
        #create a bunch of stuff in the sizer which doesnt fit
        for i in range(0,50):
            text = "Line: " + str(i)
            sizerV.Add(wx.StaticText(self, label=text), 0)

        self.SetSizer(sizerV)

class Frame(wx.Frame):
    def __init__(self, parent):
        wx.Frame.__init__(self, parent, size=(200,200), Scrolled(self)
            title="Scroll Bars", style=wx.CAPTION)
Fire Lancer
  • 29,364
  • 31
  • 116
  • 182
  • in fact there's no support for scrolling in PythonCard as mentioned by the maintainer. and that made me convert the code to pure wx from pythoncard, using scrolledpanels. thnaks for reply – altunyurt Feb 15 '09 at 21:36