The document provides instructions for designing a GUI using QT Designer in PyQT4. It describes how to add labels, line edits, buttons and connect them with signals and slots. It also covers laying out widgets horizontally and vertically, making the GUI responsive by using a grid layout, saving the project as a UI file and converting it to a Python script to execute the GUI application.
This is a brief introduction about cross platform and GUI (graphical user interface), and the Qt framework.
these slides intended to newbie programmers who want to know about cross platform and GUI.
Introduction to Qt cross-platform application and UI framework. Explaining what Qt does, some historical background, hybrid Internet Applications with Qt Webkit and the future with Qt Quick.
The Qt Script module enables you as a Qt/C++ application developer to seamlessly integrate scripting into your application, providing script authors with an interface for working in the context of your particular Qt application. The Qt Script language is very similar to JavaScript, so many developers and designers should already find it familiar. This session gives an overview of the main steps of embedding Qt Script into an application, and covers some typical patterns of usage.
Presentation by Kent Hansen held during Qt Developer Days 2009.
http://qt.nokia.com/developer/learning/elearning
This is a brief introduction about cross platform and GUI (graphical user interface), and the Qt framework.
these slides intended to newbie programmers who want to know about cross platform and GUI.
Introduction to Qt cross-platform application and UI framework. Explaining what Qt does, some historical background, hybrid Internet Applications with Qt Webkit and the future with Qt Quick.
The Qt Script module enables you as a Qt/C++ application developer to seamlessly integrate scripting into your application, providing script authors with an interface for working in the context of your particular Qt application. The Qt Script language is very similar to JavaScript, so many developers and designers should already find it familiar. This session gives an overview of the main steps of embedding Qt Script into an application, and covers some typical patterns of usage.
Presentation by Kent Hansen held during Qt Developer Days 2009.
http://qt.nokia.com/developer/learning/elearning
( ** Python Certification Training: https://www.edureka.co/python ** )
This Edureka PPT on Tkinter tutorial covers all the basic aspects of creating and making use of your own simple Graphical User Interface (GUI) using Python. It establishes all of the concepts needed to get started with building your own user interfaces while coding in Python.
PT1420 Modules in Flowchart and Visual Basic .docxamrit47
PT1420: Modules in Flowchart and Visual Basic
Page 1
This lab requires you to think about the steps that take place in a program by designing a
flowchart. Use an application such as Raptor or Visio. Read the following program prior to
completing the lab.
Data Communications Corp wants a small program that will calculate the cost of UTP it
installs for their clients. Write a program that will ask the user to input the name of the
client and the number of feet of cable installed. The program should then calculate and
display a final bill. Cost per foot of UTP is .21 cents. Be sure to add on a tax of 6%. Final
bill should include the total cost and client name. Be sure to add modules to your
program.
Step 1: In main, create a module called declareVariables() that will set your variables to 0 or “ “.
Click the Call Symbol on the Left and Drag and Drop to the flow lines between Start and Stop.
Double click on the Call Symbol and type the name of your first module. For example, type
declareVariables in the Enter Call box. Do not put the ( ) when using Raptor. Click the Done
button. A new box will pop up that will ask you to create a new tab. Click Yes. A new tab will be
created for your new method. Notice the new Tab called declareVariables.
Watch the Help Video 4-2 to see how to add modules and initialize variables in Raptor and
Visio.
PT1420: Modules in Flowchart and Visual Basic
Page 2
Step 2: Continue this process to add your additional methods, which are inputData(),
calcCosts(), and displayBill(). Main should look like this:
In Raptor
In Visio
Start
End
declareVariables()
inputData()
calcCosts()
displayBill()
Step 3: Click on the inputData module and add the necessary code to input clientName and
feetUTP. Watch the Help Video 4-2 to see how to input variables in Raptor and Visio.
Step 4: Click the calcCosts module and add the necessary code to compute calculations. Watch
the Help Video 4-2 to see how to add calculations in Raptor and Visio.
Step 5: Click the displayBill module and add the necessary code to display the clientName and
totalCost to the screen. Watch the Help Video 4-2 to see how to display variables in Raptor and
Visio.
PT1420: Modules in Flowchart and Visual Basic
Page 3
Step 6: If you are using Raptor, you can run your program. Click Run, then Execute to Finish. For
your input, enter a client name such as Bumpco Inc and ...
Python is a high-level, general-purpose programming language. Its design phil...bhargavi804095
Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation.[31]
Python is dynamically typed and garbage-collected. It supports multiple programming paradigms, including structured (particularly procedural), object-oriented and functional programming. It is often described as a "batteries included" language due to its comprehensive standard library.[
( ** Python Certification Training: https://www.edureka.co/python ** )
This Edureka PPT on Tkinter tutorial covers all the basic aspects of creating and making use of your own simple Graphical User Interface (GUI) using Python. It establishes all of the concepts needed to get started with building your own user interfaces while coding in Python.
PT1420 Modules in Flowchart and Visual Basic .docxamrit47
PT1420: Modules in Flowchart and Visual Basic
Page 1
This lab requires you to think about the steps that take place in a program by designing a
flowchart. Use an application such as Raptor or Visio. Read the following program prior to
completing the lab.
Data Communications Corp wants a small program that will calculate the cost of UTP it
installs for their clients. Write a program that will ask the user to input the name of the
client and the number of feet of cable installed. The program should then calculate and
display a final bill. Cost per foot of UTP is .21 cents. Be sure to add on a tax of 6%. Final
bill should include the total cost and client name. Be sure to add modules to your
program.
Step 1: In main, create a module called declareVariables() that will set your variables to 0 or “ “.
Click the Call Symbol on the Left and Drag and Drop to the flow lines between Start and Stop.
Double click on the Call Symbol and type the name of your first module. For example, type
declareVariables in the Enter Call box. Do not put the ( ) when using Raptor. Click the Done
button. A new box will pop up that will ask you to create a new tab. Click Yes. A new tab will be
created for your new method. Notice the new Tab called declareVariables.
Watch the Help Video 4-2 to see how to add modules and initialize variables in Raptor and
Visio.
PT1420: Modules in Flowchart and Visual Basic
Page 2
Step 2: Continue this process to add your additional methods, which are inputData(),
calcCosts(), and displayBill(). Main should look like this:
In Raptor
In Visio
Start
End
declareVariables()
inputData()
calcCosts()
displayBill()
Step 3: Click on the inputData module and add the necessary code to input clientName and
feetUTP. Watch the Help Video 4-2 to see how to input variables in Raptor and Visio.
Step 4: Click the calcCosts module and add the necessary code to compute calculations. Watch
the Help Video 4-2 to see how to add calculations in Raptor and Visio.
Step 5: Click the displayBill module and add the necessary code to display the clientName and
totalCost to the screen. Watch the Help Video 4-2 to see how to display variables in Raptor and
Visio.
PT1420: Modules in Flowchart and Visual Basic
Page 3
Step 6: If you are using Raptor, you can run your program. Click Run, then Execute to Finish. For
your input, enter a client name such as Bumpco Inc and ...
Python is a high-level, general-purpose programming language. Its design phil...bhargavi804095
Python is a high-level, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation.[31]
Python is dynamically typed and garbage-collected. It supports multiple programming paradigms, including structured (particularly procedural), object-oriented and functional programming. It is often described as a "batteries included" language due to its comprehensive standard library.[
2. 4
Design a GUI using QT Designer of PyQT4
QT Designer
Create widget
Using Filter: Label
Drag and drop to the new widget
Adjust size
Press Ctrl+R to view what you created
Filter: Line Edit
Drag and drop to widget
Filter: Button
Drag and drop a push button
3. 5
Signals and slots: Components communication
Move from Edit Widget mode to Edit Signal/Slots
mode
Or press F4
Use F3 to go back to Edit Widget mode
Next, we want the Push button to affect the Hello
world label
Click and drug a line from the
button to the label
4. 6
Signals and slots: Components communication
Select the result of the “IF-THEN” statement
Select clicked() and Next clear()
F3 to go back to Edit Widget mode
Change the name
of the button to show Clear
Ctrl+R
Try it!
6. 8
Signals and slots: Components communication
We want the textbox to edit the label
F4 to go to Edit Signal/Slots mode
IF textChanged(QString) THEN setText (QString)
7. 9
Signals and slots: Components communication
Ctrl+R
Type to the text box
IF push button THEN clicked()->clear()
8. 10
Edit widget
F3
Select Push button and Text box
Lay out Horizontally
Select 3 items
Lay Out Vertically
9. 11
Edit widget
Make the widget responsive
Select Form: QWidget from Object Inspector
Lay Out in a Grid
Ctrl+R
Resize widget size
10. 12
Save project and convert it to python script
Save it as a ui file
qt_hello.ui (like XML schema)
Convert ui file to python code
Open a command line
C:Python27Libsite-packagesPyQt4
pyuic4 -o OutFile_ui.py InFile.ui
Pyuic4.bat file is in
C:Python27Libsite-packagesPyQt4
11. 13
Execute your script using python
Open qt_hello.py using an editor
Add import sys after from PyQt4 import QtCore, QtGui
At the end of your code add:
def main():
app = QtGui.QApplication(sys.argv)
window = QtGui.QDialog()
ui = Ui_Form()
ui.setupUi(window)
window.show()
sys.exit(app.exec_())
if __name__ == "__main__":
main()
System-specific parameters
and functions
Define a new function called main()
without any parameters
The QDialog class is the base class of
dialog windows.
A dialog window is a top-level window
mostly used for short-term tasks and
brief communications with the user.
Initializes the window system and
constructs an application object
with argc command line arguments
in argv. sys. argv is a list in Python,
which contains the command-line
arguments passed to the script.Form created
from QT Designer
When the Python interpreter reads a source
file, it executes all of the code found in it.
12. 14
Execute your script using python
Open cmd (command shell)
python py_hello.py
In a lab pc you have to write the full path of python from
the folder that you save the py_hello.py file, e.g.
C:Python27python py_hello.py