From the course: Rapid Application Development with Python
Introducing wxPython - Python Tutorial
From the course: Rapid Application Development with Python
Introducing wxPython
- We've already installed wxPython, so let's build a Hello World At with it. I'll use Visual Studio Code to do this. I'm starting with a new file and I'll save it as wxHelloWorld.py. Now that Visual Studio Code knows that we have a Python script, we get the Python editing highlights. Let's write our first wxPython program. The first thing I need to do is import WX, to import the wxLibrary to provide access to the full wxPython capability. Then I'll create the wxPython GUI application by saying app equals wx.App false. And then create the frame for adding GUI components using frame equals wxFrame None because there's no parent wx.ID Any, to request that Python assign a unique variable of its own choice to this object and using a Window title of Hello World. We'll then activate this Window using the show method, frame.Show, True. We complete the GUI program by putting it into a loop and waiting for an event app.Mainloop. And as we haven't written any events ourselves, the only event in this program is to close the app. Let's save this and run it using the run button at the top right. We get a Window with the title of Hello World. Okay, we've created and run our first wxPython GUI program.
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
Introducing wxPython2m 13s
-
(Locked)
Class-based skeleton4m 37s
-
(Locked)
Labels and buttons3m 38s
-
(Locked)
More on buttons3m 33s
-
(Locked)
Checkboxes and radio buttons6m 43s
-
(Locked)
Text entry controls4m 36s
-
(Locked)
Use spinners to set values4m 58s
-
(Locked)
Create lists to select from6m 9s
-
(Locked)
Use combo boxes54s
-
(Locked)
Compose a menu bar6m 46s
-
(Locked)
Challenge36s
-
(Locked)
Solution2m 54s
-
-
-
-