Python 3 WxPython ScrolledPanel Framed Window in Both Vertical and Horizonal Scrollbars Example in GUI Desktop App Full Project For Beginners

Python 3 WxPython ScrolledPanel Framed Window in Both Vertical and Horizonal Scrollbars Example in GUI Desktop App Full Project For Beginners

 

Welcome folks today in this blog post we will be  displaying scrolledpanel framed window in both vertical and horizontal scrollbar  desktop app in python using frame class. All the full source code of the application is given below.

 

 

Get Started

 

 

In order to get started you need to install the below library using the pip command as shown below

 

pip install wxpython

 

After installing this library you need to make an app.py file and copy paste the following code

 

app.py

 

 

import wx

class ScrollbarFrame(wx.Frame):
    def __init__(self):
        wx.Frame.__init__(self, None, -1, 'Scrollbar Example', 
                size=(300, 200))
        self.scroll = wx.ScrolledWindow(self, -1)
        self.scroll.SetScrollbars(1, 1, 600, 400)
        self.button = wx.Button(self.scroll, -1, "Scroll Me", pos=(50, 20))
        self.Bind(wx.EVT_BUTTON,  self.OnClickTop, self.button)
        self.button2 = wx.Button(self.scroll, -1, "Scroll Back", pos=(500, 350))
        self.Bind(wx.EVT_BUTTON, self.OnClickBottom, self.button2)

    def OnClickTop(self, event):
        self.scroll.Scroll(600, 400)
        
    def OnClickBottom(self, event):
        self.scroll.Scroll(1, 1)
        
if __name__ == '__main__':
    app = wx.PySimpleApp()
    frame = ScrollbarFrame()
    frame.Show()
    app.MainLoop()

 

See also  Python 3 Tkinter GUI Script to Build a Crawler to Scrape all Links or URLs From Website Using BeautifulSoup4 Library Full Project For Beginners

 

If you execute the above python script by typing the below command

 

python app.py

 

 

Leave a Reply