We subclass that class and use it as our mainWidget ui file from Qt designer into a python class What we are going to do is We compile the. In the picture, you can see a simple GUI, with in green letters the names of the widgets. so we want to use Qt3 Designer for creating our GUI. if _name_ = "_main_" : app = HelloApplication ( sys. show () def slotSayHello ( self ): """ This is an example slot, a method that gets called when a signal is emitted """ print ( "Hello, World!" ) # Only actually do something if this script is run standalone, so we can test our # application, but we're also able to import this program without actually running # any code. QPushButton ( "Say 'Hello world!'" ) self. addWidgets () def addWidgets ( self ): """ In this method, we're adding widgets and connecting signals from these widgets to methods of our class, the so-called "slots" """ self. QApplication ): def _init_ ( self, args ): """ In the constructor we're doing everything to get our application started, which is basically constructing a basic QApplication by its _init_ method, then adding our widgets and finally starting the exec_loop.""" Qt. #!/usr/bin/env python import sys from PyQt4 import Qt class HelloApplication ( Qt.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |