通过PyQt5编写天气预报界面程序

阅读: 评论:0

通过PyQt5编写天⽓预报界⾯程序1:通过Qt Designer设计WeatherWin.ui界⾯
a:到Library/bin下的Qt设计器,点击designer,启动Qt设计器
b:启动之后是这样的厦门园博园要门票吗
标题
c:新建窗体中选第⼀个,然后创建好后如下。
d:上图界⾯的所有控件详细清单如下:
e:weatherComboBox中的详细信息如下:
f:定义好两个按钮的信号与槽函数如下
g:两个槽函数要⾃⼰定义好,如下
h:WeatherWin.ui界⾯代码如下:
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>581</width>
<height>358</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<widget class="QPushButton" name="QueryBtn">  <property name="geometry">
<rect>
<x>100</x>
<y>310</y>重庆游轮游三峡价格
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>查询</string>
</property>
</widget>
<widget class="QPushButton" name="clearBtn">  <property name="geometry">
<property name="geometry">
<rect>
<x>420</x>
<y>310</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>清空</string>
</property>
</widget>
<widget class="QTextEdit" name="resultText">
<property name="geometry">
<rect>
<x>50</x>
<y>110</y>
<width>491</width>
<height>181</height>
</rect>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>20</x>
<y>10</y>
<width>81</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>查询城市天⽓</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>40</x>
<y>40</y>成都市内著名景点
<width>61</width>
<height>16</height>
</rect>
</property>
<property name="text">
<string>城市</string>
</property>
</widget>
<widget class="QComboBox" name="weatherComboBox">  <property name="enabled">
<bool>true</bool>
</property>
<property name="geometry">
<rect>
<x>100</x>
<y>40</y>
<width>361</width>
<height>22</height>
</rect>
</property>
<property name="editable">
<bool>true</bool>东北冬季旅游必去十大景点
</property>
<property name="duplicatesEnabled">
<bool>true</bool>
</property>
</property>
<item>
<property name="text">
<string>上海</string>
</property>
</item>
<item>
<property name="text">
<string>北京</string>
</property>
</item>
<item>
<property name="text">
<string>天津</string>
</property>
匈牙利地图
</item>
<item>
<property name="text">
<string>桂林</string>
</property>
</item>
</widget>
</widget>
<resources/>
<connections>
<connection>
<sender>QueryBtn</sender>  <signal>clicked()</signal>
<receiver>Dialog</receiver>  <slot>QueryWeather()</slot>  <hints>
<hint type="sourcelabel">
<x>121</x>
<y>314</y>
</hint>
<hint type="destinationlabel">    <x>219</x>
<y>335</y>
</hint>
</hints>
</connection>
<connection>
<sender>clearBtn</sender>  <signal>clicked()</signal>
<receiver>Dialog</receiver>  <slot>clearResult()</slot>
<hints>
<hint type="sourcelabel">
<x>437</x>
<y>319</y>
</hint>
<hint type="destinationlabel">    <x>512</x>
广州岭南印象园<y>338</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>QueryWeather()</slot>  <slot>clearResult()</slot>
</slots>
</ui>

本文发布于:2023-08-24 13:27:48,感谢您对本站的认可!

本文链接:http://www.035400.com/whly/2/595028.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:预报   旅游   重庆
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2024-2030 Comsenz Inc.Powered by © 文化旅游网 滇ICP备2022007236号-403 联系QQ:1103060800网站地图