PyQt Basics: Using Widgets

preview_player
Показать описание

In this video, Ben Finkel covers one of the core elements of PYQT: using widgets. This is the primary user interface in PYQT, and they cover everything from the containing window of your user interface down to every single checkbox, text box, and all other user interface elements imaginable.

Widgets is the term used to collectively refer to all of the different user interface elements inside of a GUI application. These are the individual components that make up a graphical user interface; most of us are so used to working with so many elements of this kind that we don’t even realize that these are individual components.

These range from things like QLabels, a piece of text that isn’t interactive and is simply printed out on your window, to a QPush Button that has an event associated with it. All widgets must belong to a parent element — they can’t just exist on their own.

Ben walks through all of the elements of widgets, how they’re structured, and how to use them effectively in a given application.

Start learning with CBT Nuggets:

Рекомендации по теме
Комментарии
Автор

6:20 I love QT Designer. I don't know if there is one for OSX. I assume there is.

SHONNER
Автор

Is there a way to convert a Qt widget, such that it can be used in PyQt? I know pyqt-led exists, but there's so many more Analog-widgets on linux-apps (formerly qt-apps)! For example, I tried this in Linux

1) Running Python 3.4, I install RiverBank's SIP 4.16.3,
("python configure.py", "nmake", "nmake install"),
2) Then statically built (code.pro) analogwidgets with Qt Creator 5.3 (VS 2010 Express)
3) In linux, from the SIP directory, I run "python setup.py build" and "python setup.py install"**
4) LD_LIBRARY_PATH should be set to pull in the analogwidgets library at runtime
5) But then in PyQt, when I try to instantiate it, it doesn't work ("from AnalogWidgets import ThermoMeter")

**
python setup.py
#!/usr/bin/env python

from distutils.core import setup, Extension
import sipdistutils

analogwidgets_module = Extension("AnalogWidgets",
["analogwidgets.sip"],
include_dirs=["/usr/local/Qt-5.3.1/include",
"/usr/local/Qt-5.3.1/include/QtCore",
"/usr/local/Qt-5.3.1/include/QtWidgets",
"/usr/local/Qt-5.3.1/include/QtGui",
"/home/userbn/AnalogWidgets/analogwidgets/analogwidgets"],
library_dirs=["/usr/local/lib64", "/usr/local/Qt-5.3.1/lib"],
libraries=["analogwidgets", "Qt5Gui", "Qt5Widgets", "Qt5Core"],
)

setup(name='AnalogWidgets',
version='1.0',
ext_modules=[ analogwidgets_module ],

)

bennguyen