2013-07-05 19 views
0

我需要一個滾動的框架窗口,並嘗試使用滾屏()方法滾動窗口,應該是什麼這個方法文檔字符串,使框架完全可滾動的參數..在wxPython

ScrollWindow(self, int dx, int dy, Rect rect=None) 

Physically scrolls the pixels in the window and move child 
windows 
accordingly. Use this function to optimise your scrolling 
implementations, to minimise the area that must be redrawn. 
Note that 
it is rarely required to call this function from a user program. 

進口WX

class Example(wx.Frame): 

    def __init__(self, parent, title): 
     super(Example, self).__init__(parent, title=title, 
      size=(300, 250)) 

     self.InitUI() 
     self.Centre() 
     self.Show() 
     self.ScrollWindow() 


    def InitUI(self): 

     panel = wx.Panel(self) 

     hbox = wx.BoxSizer(wx.HORIZONTAL) 

     fgs = wx.FlexGridSizer(3, 2, 9, 25) 

     title = wx.StaticText(panel, label="Title") 
     author = wx.StaticText(panel, label="Author") 
     review = wx.StaticText(panel, label="Review") 

     tc1 = wx.TextCtrl(panel) 
     tc2 = wx.TextCtrl(panel) 
     tc3 = wx.TextCtrl(panel, style=wx.TE_MULTILINE) 

     fgs.AddMany([(title), (tc1, 1, wx.EXPAND), (author), 
      (tc2, 1, wx.EXPAND), (review, 1, wx.EXPAND), (tc3, 1, wx.EXPAND)]) 

     fgs.AddGrowableRow(2, 1) 
     fgs.AddGrowableCol(1, 1) 

     hbox.Add(fgs, proportion=1, flag=wx.ALL|wx.EXPAND, border=15) 
     panel.SetSizer(hbox) 


if __name__ == '__main__': 

    app = wx.App(False) 
    Example(None, title='Review') 
    app.MainLoop() 

回答

0

ScrollWindow不會添加滾動窗口,它用於製作窗口滾動,這是它在您的文章中陳述的內容。

物理滾動窗口中的像素並相應地移動子窗口。

有ScrolledWindow或ScrolledPanel必須在wxPython的演示一起來看看他們