filmov
tv
Python S1E4 :: WxPython - wxTextCtrl and Buttons - Get,Set Values,Clicks

Показать описание
In this class we will look at how to use Labels, TextFields and Buttons in wxPython.
We render a simple input form in our wx Form. The user types data into the textfields, he then presses one button to get whatever was typed displayed in a wxPython messagebox.
He clicks another button to set the old values.
What is wx.Button?
A Button, generally, is a control that reacts to click events so as to initiate an action. Buttons are one if the most common User Interface elements.
Through buttons users can instruct an application to perform a pre-defined action just through a click event.
Obviously wxPython also include Buttons. These be placed on a dialog box or on a wx.Panel panel, or indeed on almost any other window.
If none of the alignment styles are specified, the label is centered both horizontally and vertically.
You can create a basic wx.Button with text only as its caption.
wx.Button Events
The wx.Button provides us with the following event which we can handle as we will see in our example:
EVT_BUTTON: Process a wxEVT_BUTTON event, when the button is clicked.
wx.TextCtrl
Normally in applications you always need to input some data. You need to allow users to type some inputs into the application for example.
Therefore wxPython provides us with the wx.TextCtrl component which allows text to be edited and displayed.
wxTextCtrl is what is normally called TextField, TextBox or EditText in other common GUI toolkits.
wx.TextCtrl supports both single line and multiple lines.
Let's start.
Комментарии