In the article on building a Pyqt environment, I introduced how to build a PyQt UI design environment on the dragonboard 410c development board. Today I will further teach you how to use pyQt to build your own interactive program interface. .
In the last blog, I just taught you to simply call the interface provided by pyqt on 410c to complete the simple interface creation and operation. But for complex interfaces, if we use this method to build, I believe many people are very difficult to get started. Also in our pyqt can also use the existing qt designer to carry out our interface design, you can install Python3.4 and pyqt on windows, the specific installation method is similar to the previous installation method on dragonboard 410c You can also refer to Pyqt5 to install a document on the windows platform.
Once installed, we can find the location of the pyqt5 package as follows:
In the pyqt5 directory, you can see the documentation, tools, and examples for pyqt development. The contents of the directory are described below:
Doc pyqt5 related documentation, find index.html is the index of the entire help documentation, you can see the introduction of the Python API
Examples routine
Designer.exe interface designer tool
The pyrcc5.exe resource compiler has resource files when designing the interface. It needs to be compiled into a py file with this compilation tool.
The pyuic5.bat interface converter can be used to convert Python scripts with a .ui file designed by the designer.
After understanding the above documents and tools, you can use pyqt to develop. In this blog, we mainly use the designer tool to build our weather forecast demo interface. First, open the designer, exe tool, you can use this tool to UI design, here we design the weather forecast UI as shown in the following figure. The specific ui file is downloaded to http://pan.baidu.com/s/1o8uEXp4.
Saved as mainwindow.ui, the interface uses more controls, not detailed, you can download the ui file and use designer, exe to open the view, then we can use the pyuic5 tool to convert the ui file into a py file, you can execute Python script file, open the cmd command editor, and then type the following command to get the Python script:
After getting the mainwindow.py Python script, we use Notepad to open as shown below
Here is the converted ui class written in pyqt with Python, but there is no main function. The script does not respond without seeing the interface. Here we also need to create a Python script file, by inheriting the class and adding the main function to the class. The instantiation can be displayed. Here we have created a weatherWindow, py file. The specific file can be downloaded from http://pan.baidu.com/s/1geS2Wrp. Here we build a weatherWindows class, in this class The Ui_mainwindow class has been refactored.
At the same time, the class is instantiated by calling the main function as follows:
At this time, copy all the files to the dragonbaord 410c, and run the weatherWindow script to see the interface:
Here we have built the weather forecast demo interface, but from the interface point of view does not show any data, the post blog will further teach you how to use the Python script to use the wifi network of dragonbaord 410c to get the weather information data to fill the corresponding controls in the interface Display in the middle to achieve real-time display of the weather.
Anyang Kayo Amorphous Technology Co.,Ltd is located on the ancient city-Anyang. It was founded in 2011 that specializes in producing the magnetic ring of amorphous nanocrystalline and pays attention to scientific research highly,matches manufacture correspondingly and sets the design,development,production and sale in a body.Our major product is the magnetic ring of amorphous nanocrystalline and current transformer which is applied to the communication, home appliances, electric power, automobile and new energy extensively. We are highly praised by our customers for our good quality,high efficiency,excellent scheme,low cost and perfect sale service.
Nano-crystalline Common Mode Choke Cores have high saturation magnetic induction that can reduce the volume of CMC,outstanding ability to resist unblanced current, excellent impedance and tamperature stability.So it can be used to the inverter circuit ,frequency converter.UPS, switching power,EMC filter and new energy.
Nano Cmc Iron Core,Best Cmc Core,New Energy Cmc Core,Utility Cmc Core,Real Cmc Core
Anyang Kayo Amorphous Technology Co.,Ltd. , https://www.kayoamotech.com