简体   繁体   中英

Building standalone desktop GUI app using wxpython

I have created a python script using Mechanize and BeautifulSoup, to login to a website and hardcoded credentials and url in the script. It worked fine.

My requirement now is to build a standalone desktop GUI app using wxpython or any other on which an user can input URL and credentials which can then call the python script.

I started learning wxpython, but not exactly sure how to proceed on this.

Can anyone brief me a prototype for this requirement and guide me in building GUI.

GUI requires. 3 Input Textboxes 1 submit button which invokes python script

Thanks

wxPython has all the widgets you need. I highly recommend downloading the wxPython demo package to see how they all work. What you will want to look at are the following elements:

  • wx.TextCtrl
  • wx.Button
  • wx.BoxSizer (optional, but recommended)

The BoxSizer will allow you to resize your application and have the widgets adjust their size accordingly. There are many tutorials available that demonstrate these concepts as well as a friendly wxPython Google Group and IRC channel.

After entering the text in your text controls, you will want to have bound your button widget to an event handler that will call Mechanize or BeautifulSoup or whatever. You can also do some data validation in the button event before using the data if you want to.

If your target audience isn't going to have Python installed, then you will need to look into how to create apks and exes. There are many Python packages that can help with that such as:

  • py2exe
  • py2app
  • PyInstaller
  • Briefcase
  • cx_freeze

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM