Python Learning Note Phase II Gui-wxpython

Source: Internet
Author: User

Since most of the basics have been learned in the early stages, it is an intermediate stage for an in-depth understanding of the basics and Python usage. Open the first article on the GUI-related, in order to strengthen the sensory understanding.

1. What is Wxpython

is a Python GUI toolkit.

Download path: https://www.wxpython.org. Automatic Update download can also be done via PIP3 install-u Wxpython

2.wxpython Foundation

2.1 window (QQ instance)

Create an Application object: Qq=w X.app ()

Create an application to display the window windows=wx. Frame (none,title= "application title", size= (long, wide))

Make the window you have created visible: Windows. Show (True)

Enter the management loop of the application (exit until close): QQ. Mainloop ()

Add a control to a known window: Button=wx. Button (windows,pos= (long, wide), size (long, wide))

Add an event on a known control: button. Bind (WX. Evt_button, event or function method)

2.2 Layout Management

Because the control is placed in POS and the control itself sizes size size, it is not possible to adapt the window (Windows) changes, add the Pannel panel to differentiate the area (the menu bar, the status bar, etc.) can be distinguished.

Create panels to differentiate window blocks: panel=wx. Panel (Windows)

Create window block: box=wx. Boxsizer ()

Sets the absolute position of the window block and whether it can be stretched, box. ADD (self.button,proportion=1,flag=wx. EXPAND)

3. Calculator example (use Wxpython to write a simple calculator)

--and so on after the completion of the update--it seems to be written directly some difficulty, need to train constructors, classes, overloads and other related knowledge---

Python Learning Note Phase II Gui-wxpython

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.