From the course: Rapid Application Development with Python

What is wxGlade? - Python Tutorial

From the course: Rapid Application Development with Python

Start my 1-month free trial

What is wxGlade?

- Now that we've got a solid foundation of wxPython. let's see how we can use wxGlade to do rapid gooey creation for our Python applications. wxGlade is not a fully featured IDE, it's a graphical user interface builder for wxPython. wxGlade enables you to take a graphical approach to designing your gooey app and then generate pure wxPython code to present the user interface. You then need to use an IDE such as visual studio code to add functional code to the design. The wxGlade interface has a menu and three key panels, at the top left is the set of widgets that can be used in the application design. The bottom left pane is the configuration details of the currently selected widget. The right hand side is the design structure. The initial screen is set up as a new application with nothing else. The first thing we need to do is to add a frame to the application. We can do that by clicking the top left widget and we'll accept the default wxframe and click okay. wxGlade adds a frame to the application and also a sizer and a slot and presents a preview of what the design looks like. The sizer is a form of widget, which provides a means of either vertical or horizontal placement of real widgets. And is the container for slots. A slot is the point of where we can place a single widget or another sizer to hold multiple widgets. I select the frame and the bottom left we can see its configuration. I change the class name to csframe. Now look at the widget tab. Now change the title to cybersecurity framework auditor. The sizer is fine, I don't need to change anything there. The initial slot is the point from which we'll start the design and to start the design, we need to place a panel on the slot. If I just wanted a plain screen for my widgets, I could add a panel here, that's the top right widget. However, I'm planning a tap sheet design using the notebook widget, and this has its own built in panels for each tab. So the first thing I'll do is add a notebook widget, which I do by clicking the left most of the containers in the widget pane, and then clicking on the slot. I'll accept the top orientation default. I've now got a notebook with a single tab, but I'm planning to have two, so I'll right click on the tap panel and add a notebook tab. We now have two tabs. Let's select the notebook widget and in the lower left pane changes name to nb. This will be a prefix in our code. So I'd like to keep it short, but meaningful. I'll now select the first of the temp panels and change its name to nb one. This is the name by which I can refer to it in my code. To change the description that appears in the tab itself, I can double click where it says notebook one pane one, and I'll call this main. I'll do the same with the second tab sheet and call that nb two, and change its name to audit. We've not done much yet, but we can take a look at the design by right clicking on a widget and selecting preview. I'll save this work as a design project by selecting file, save as, and in my python folder, I'll call it CSF Audit. We've not done much yet but we can take a look at the design by right clicking on a widget and selecting preview frame. This looks okay so far, and I'll close that. We've now got the design foundation for constructing our application.

Contents