Just a Button - russ-hensel/qt5_by_example GitHub Wiki
After the magic incarnation of:
search Magic Incantation: create a app application
We are ready to do our first simple user interface widget, a button.
First: what is a widget.
A widget is any ( usually little ) object that you can put on a user interface so the user can interact with it and your application. You have all seen/used buttons, so lets make one.
We will again use the code from the basic application:
There are two steps, make the widget, and then place the widget on the window.
to make it
widget = QLabel( "Click Me" )
# this button will say "Click Me"
place on the window:
a_layout.addWidget( widget )
What is a_layout? It is a so called layout manager, each time it is called via addWidget( ) it adds the widget to the part of the interface that the layout itself belogns to. To add 20 widgets callit 20 times with 20 different widgets.
In the code I skipped: widget.clicked.connect( self.on_button_click )
This code is what makes the button do something when clicked, here call a method self.on_button_click()
search deeper dive button
Some code here but lets improve:
idle_file /mnt/WIN_D/russ/0000/python00/python3/_projects/qt5_by_example/tabs/tab_misc_widgets.py