From the course: Rapid Application Development with Python

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Labels and buttons

Labels and buttons - Python Tutorial

From the course: Rapid Application Development with Python

Start my 1-month free trial

Labels and buttons

- Let's now play some text onto the panel in our test application. We can do this using a static text, which is otherwise known as a label. We can add this line into the top frame initialization immediately after line five, where we create the panel. I went to wx.StaticText, and this will be located on the panel, and we will use a default object identifier, and we'll say, this is static text. Okay, let's run this. And we can see, we now have a label showing on the panel. We can have positional information to this, to place it on the panel where we want it to be. Let's update the text widget to locate it five points in from the left, and 60 points down. And we do this using pos equals (5,60). Now, when we run this, the label is showing where we positioned it on the panel. Placing a button on the panel, there's a bit more work because we need to think about what happens when someone presses the button. We do this with the…

Contents