Python wx 模块,ScrollBar() 实例源码

我们从Python开源项目中,提取了以下4个代码示例,用于说明如何使用wx.ScrollBar()

项目:Turrican2Editor    作者:GitExl    | 项目源码 | 文件源码
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER):
        wx.Panel.__init__(self, parent, id=id, pos=pos, size=size, style=style)

        self.Viewport = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.NO_BORDER)
        self.Scrollbar = wx.ScrollBar(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SB_VERTICAL)

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(self.Viewport, 1, wx.EXPAND, 0)
        sizer.Add(self.Scrollbar, 0, wx.EXPAND, 0)

        self.SetSizer(sizer)
        self.Layout()
        sizer.Fit(self)

        self._presenter = Presenter.from_window(self.Viewport.GetHandle(), config.SCALE)

        self._graphics = None
        self._font = None
        self._entities = None

        self._selected_index = -1

        self.Viewport.Bind(wx.EVT_PAINT, self.paint)
        self.Viewport.Bind(wx.EVT_SIZE, self.resize)
        self.Viewport.Bind(wx.EVT_MOUSEWHEEL, self.mouse_wheel)
        self.Viewport.Bind(wx.EVT_LEFT_DOWN, self.mouse_left_down)
        self.Scrollbar.Bind(wx.EVT_SCROLL, self.scroll)
项目:Turrican2Editor    作者:GitExl    | 项目源码 | 文件源码
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER):
        wx.Panel.__init__(self, parent, id=id, pos=pos, size=size, style=style)

        self.Viewport = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.NO_BORDER)
        self.Scrollbar = wx.ScrollBar(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.SB_VERTICAL)

        sizer = wx.BoxSizer(wx.HORIZONTAL)
        sizer.Add(self.Viewport, 1, wx.EXPAND, 0)
        sizer.Add(self.Scrollbar, 0, wx.EXPAND, 0)

        self.SetSizer(sizer)
        self.Layout()
        sizer.Fit(self)

        self.Scrollbar.SetScrollbar(0, 0, 0, 0)

        self._presenter = Presenter.from_window(self.Viewport.GetHandle(), config.SCALE)
        self._camera = Camera(0, 0, 0, 0)

        self._tilemap = None
        self._tileset = None
        self._select_start = None
        self._select_end = None

        self._show_collision = False

        self.Viewport.Bind(wx.EVT_PAINT, self.paint)
        self.Viewport.Bind(wx.EVT_SIZE, self.resize)
        self.Viewport.Bind(wx.EVT_MOUSEWHEEL, self.mouse_wheel)
        self.Viewport.Bind(wx.EVT_LEFT_DOWN, self.mouse_left_down)
        self.Viewport.Bind(wx.EVT_LEFT_UP, self.mouse_left_up)
        self.Viewport.Bind(wx.EVT_MOTION, self.mouse_move)
        self.Scrollbar.Bind(wx.EVT_SCROLL, self.scroll)
项目:GRIPy    作者:giruenf    | 项目源码 | 文件源码
def __init__(self, parent, pixelsPerUnit=20):
        wx.StatusBar.__init__(self, parent, -1)

        self.pixelsPerUnit = pixelsPerUnit
        self.SetMinHeight(16)

        # Dummy panel para encobrir a ScrollBar
        #self.panelDummy = wx.Panel(self)
        #self.panelDummy.SetBackgroundColour('green')
        #self.panelDummy.Show(False)


        self.SetFieldsCount(3)
        self.SetStatusWidths([-3, -1, -1])
        #self.SetStatusText("Aqui vai a legenda dos Logs...", 0)


        self.sb = wx.ScrollBar(self)
        self.sb.show = False
        self.sb.SetScrollbar(0, 10, 100, 10)
        self.Bind(wx.EVT_SIZE, self._OnSize)

        self.sb.Bind(wx.EVT_SCROLL_THUMBTRACK, self._OnScroll)
        self.sb.Bind(wx.EVT_SCROLL_LINEUP, self._OnScroll)
        self.sb.Bind(wx.EVT_SCROLL_PAGEUP, self._OnScroll)
        self.sb.Bind(wx.EVT_SCROLL_LINEDOWN, self._OnScroll)
        self.sb.Bind(wx.EVT_SCROLL_PAGEDOWN, self._OnScroll)

        self.sb.ultimaPosicao = 0
        self.Reposition()

        #self.timer = wx.PyTimer(self.Notify)
        #self.timer.Start(1000)
        #self.Notify()

        self.HideScrollBar()
项目:imagepy    作者:Image-Py    | 项目源码 | 文件源码
def __init__(self, parent=None):
        wx.Frame.__init__ ( self, parent, id = wx.ID_ANY,
                            title = wx.EmptyString,
                            pos = wx.DefaultPosition,
                            size = wx.Size( -1,-1 ),
                            style = wx.DEFAULT_FRAME_STYLE|wx.TAB_TRAVERSAL )
        logopath = os.path.join(root_dir, 'data/logo.ico')
        self.SetBackgroundColour( wx.SystemSettings.GetColour( wx.SYS_COLOUR_3DLIGHT ) )
        self.SetIcon(wx.Icon(logopath, wx.BITMAP_TYPE_ICO))
        self.SetSizeHints( wx.Size( 560,-1 ), wx.DefaultSize )
        WindowsManager.add(self)
        print('frame added')

        self.SetSizeHints( wx.DefaultSize, wx.DefaultSize )
        self.SetBackgroundColour( wx.Colour( 255, 255, 255 ) )

        sizer = wx.BoxSizer( wx.VERTICAL )
        self.txt_info = wx.StaticText( self, wx.ID_ANY,
                                       '500*500 pixels 173k',
                                       wx.DefaultPosition, wx.DefaultSize, 0 )
        self.txt_info.Wrap( -1 )
        sizer.Add( self.txt_info, 0, wx.ALL, 0 )

        self.canvas = Canvas(self)
        self.canvas.fit = self

        sizer.Add( self.canvas, 1, wx.EXPAND |wx.ALL, 0 )

        self.page = wx.ScrollBar( self, wx.ID_ANY,
                                  wx.DefaultPosition, wx.DefaultSize, wx.SB_HORIZONTAL)

        self.page.SetScrollbar(0,0,0,0, refresh=True)
        sizer.Add( self.page, 0, wx.ALL|wx.EXPAND, 0 )
        #self.page.Hide()
        self.SetSizer(sizer)
        self.Layout()

        self.Bind(wx.EVT_IDLE, self.on_idle)
        self.Bind(wx.EVT_SCROLL, self.on_scroll)
        self.Bind(wx.EVT_ACTIVATE, self.on_valid)
        self.Bind(wx.EVT_CLOSE, self.on_close)
        self.canvas.Bind(wx.EVT_CHAR, self.on_key)
        self.canvas.SetFocus()
        # panel.Bind(wx.EVT_CHAR, self.OnKeyDown)
        self.opage = 0
        self.Fit()

        self.SetAcceleratorTable(IPy.curapp.shortcut)