基于Dragonboard 410c的智能魔镜设计(8)-python脚本实现UI原型_第1页
基于Dragonboard 410c的智能魔镜设计(8)-python脚本实现UI原型_第2页
基于Dragonboard 410c的智能魔镜设计(8)-python脚本实现UI原型_第3页
基于Dragonboard 410c的智能魔镜设计(8)-python脚本实现UI原型_第4页
基于Dragonboard 410c的智能魔镜设计(8)-python脚本实现UI原型_第5页
已阅读5页,还剩10页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

基于Dragonboard410c的智能魔镜设计(8)——python脚本实现UI原型在上一篇文章中,已经跟大家介绍如何智能魔镜的UI原型设计,并且采用designer.exe工具完成了原始的魔镜UI界面设计,可以看出,整个魔镜的UI设计非常简单,但是如果要实心较好的效果,我们单独使用designer.exe工具很难完成,这就需要我们在完成原型设计后得到的xml文件进行进一步的修改和细化,以达到我们的设计要求。这里,大家可以直接修改designer.exe文件的xml的元素的属性等来调节和细化UI,同时也可以使用pyuic5工具将其转换成py脚本,然后对其进行修改,本文在设计中,直接使用pyuic5工具将其进行了转换,然后进行修改,最终得到的UI代码如下:#-*-coding:utf-8-*-fromPyQt5importQtCore,QtGui,QtWidgetsclassUi_MainWindow(object):defsetupUi(self,MainWindow):MainWindow.setObjectName(“MainWindow”)desktopRect=QtWidgets.QDesktopWidget().screenGeometry()MainWindow.resize(desktopRect.width(),desktopRect.height())icon=QtGui.QIcon()icon.addPixmap(QtGui.QPixmap(“:/images/icon”),QtGui.QIcon.Normal,QtGui.QIcon.Off)MainWindow.setWindowIcon(icon)self.centralWidget=QtWidgets.QWidget(MainWindow)self.centralWidget.setObjectName(“centralWidget”)self.centralWidget.resize(357,1059)self.temp=QtWidgets.QLabel(self.centralWidget)self.centralWidget.setGeometry(desktopRect.width()-self.centralWidget.width(),0,self.centralWidget.width(),self.centralWidget.height())self.temp.setGeometry(QtCore.QRect(20,60,231,100))font=QtGui.QFont()font.setFamily(“楷体”)font.setPointSize(40)font.setBold(False)font.setWeight(50)self.temp.setFont(font)self.temp.setText(“”)self.temp.setAlignment(QtCore.Qt.AlignCenter)self.temp.setObjectName(“temp”)self.city=QtWidgets.QLabel(self.centralWidget)self.city.setGeometry(QtCore.QRect(50,160,150,30))font=QtGui.QFont()font.setPointSize(13)font.setBold(True)font.setWeight(75)self.city.setFont(font)self.city.setText(“”)self.city.setAlignment(QtCore.Qt.AlignCenter)self.city.setObjectName(“city”)self.date=QtWidgets.QLabel(self.centralWidget)self.date.setGeometry(QtCore.QRect(30,245,211,25))font=QtGui.QFont()font.setPointSize(10)font.setBold(True)font.setWeight(75)self.date.setFont(font)self.date.setText(“”)self.date.setAlignment(QtCore.Qt.AlignCenter)self.date.setObjectName(“date”)self.closeButton=QtWidgets.QPushButton(self.centralWidget)self.closeButton.setGeometry(QtCore.QRect(240,5,25,25))self.closeButton.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))self.closeButton.setText(“”)self.closeButton.setFlat(True)self.closeButton.setObjectName(“closeButton”)#self.layoutWidget=QtWidgets.QWidget(self.centralWidget)self.layoutWidget=QtWidgets.QWidget(MainWindow)self.layoutWidget.setGeometry(QtCore.QRect(0,desktopRect.height()-170,desktopRect.width(),170))self.layoutWidget.setObjectName(“layoutWidget”)self.horizontalLayout=QtWidgets.QHBoxLayout(self.layoutWidget)self.horizontalLayout.setContentsMargins(11,11,11,11)self.horizontalLayout.setSpacing(6)self.horizontalLayout.setObjectName(“horizontalLayout”)self.gridLayout=QtWidgets.QGridLayout()self.gridLayout.setContentsMargins(11,11,11,11)self.gridLayout.setSpacing(8)self.gridLayout.setObjectName(“gridLayout”)self.forecast_0_date=QtWidgets.QLabel(self.layoutWidget)self.forecast_0_date.setMinimumSize(QtCore.QSize(80,20))self.forecast_0_date.setMaximumSize(QtCore.QSize(200,40))font=QtGui.QFont()font.setFamily(“微软雅黑”)font.setPointSize(8)self.forecast_0_date.setFont(font)self.forecast_0_date.setText(“”)self.forecast_0_date.setAlignment(QtCore.Qt.AlignCenter)self.forecast_0_date.setObjectName(“forecast_0_date”)self.gridLayout.addWidget(self.forecast_0_date,0,0,1,1)self.forecast_0_type=QtWidgets.QLabel(self.layoutWidget)self.forecast_0_type.setMinimumSize(QtCore.QSize(78,75))self.forecast_0_type.setText(“”)self.forecast_0_type.setScaledContents(True)self.forecast_0_type.setObjectName(“forecast_0_type”)self.gridLayout.addWidget(self.forecast_0_type,1,0,1,1)self.forecast_0_temp=QtWidgets.QLabel(self.layoutWidget)self.forecast_0_temp.setMinimumSize(QtCore.QSize(75,20))self.forecast_0_temp.setMaximumSize(QtCore.QSize(200,40))font=QtGui.QFont()font.setFamily(“微软雅黑”)font.setPointSize(8)self.forecast_0_temp.setFont(font)self.forecast_0_temp.setText(“”)self.forecast_0_temp.setAlignment(QtCore.Qt.AlignCenter)self.forecast_0_temp.setObjectName(“forecast_0_temp”)self.gridLayout.addWidget(self.forecast_0_temp,2,0,1,1)self.horizontalLayout.addLayout(self.gridLayout)self.gridLayout_2=QtWidgets.QGridLayout()self.gridLayout_2.setContentsMargins(11,11,11,11)self.gridLayout_2.setSpacing(8)self.gridLayout_2.setObjectName(“gridLayout_2”)self.forecast_1_date=QtWidgets.QLabel(self.layoutWidget)self.forecast_1_date.setMinimumSize(QtCore.QSize(75,20))self.forecast_1_date.setMaximumSize(QtCore.QSize(200,40))font=QtGui.QFont()font.setFamily(“微软雅黑”)font.setPointSize(8)self.forecast_1_date.setFont(font)self.forecast_1_date.setText(“”)self.forecast_1_date.setAlignment(QtCore.Qt.AlignCenter)self.forecast_1_date.setObjectName(“forecast_1_date”)self.gridLayout_2.addWidget(self.forecast_1_date,0,0,1,1)self.forecast_1_type=QtWidgets.QLabel(self.layoutWidget)self.forecast_1_type.setMinimumSize(QtCore.QSize(78,75))self.forecast_1_type.setText(“”)self.forecast_1_type.setScaledContents(True)self.forecast_1_type.setObjectName(“forecast_1_type”)self.gridLayout_2.addWidget(self.forecast_1_type,1,0,1,1)self.forecast_1_temp=QtWidgets.QLabel(self.layoutWidget)self.forecast_1_temp.setMinimumSize(QtCore.QSize(75,20))self.forecast_1_temp.setMaximumSize(QtCore.QSize(200,40))font=QtGui.QFont()font.setFamily(“微软雅黑”)font.setPointSize(8)self.forecast_1_temp.setFont(font)self.forecast_1_temp.setText(“”)self.forecast_1_temp.setAlignment(QtCore.Qt.AlignCenter)self.forecast_1_temp.setObjectName(“forecast_1_temp”)self.gridLayout_2.addWidget(self.forecast_1_temp,2,0,1,1)self.horizontalLayout.addLayout(self.gridLayout_2)self.gridLayout_3=QtWidgets.QGridLayout()self.gridLayout_3.setContentsMargins(11,11,11,11)self.gridLayout_3.setSpacing(6)self.gridLayout_3.setObjectName(“gridLayout_3”)self.forecast_2_date=QtWidgets.QLabel(self.layoutWidget)self.forecast_2_date.setMinimumSize(QtCore.QSize(75,20))self.forecast_2_date.setMaximumSize(QtCore.QSize(200,40))font=QtGui.QFont()font.setFamily(“微软雅黑”)font.setPointSize(8)self.forecast_2_date.setFont(font)self.forecast_2_date.setText(“”)self.forecast_2_date.setAlignment(QtCore.Qt.AlignCenter)self.forecast_2_date.setObjectName(“forecast_2_date”)self.gridLayout_3.addWidget(self.forecast_2_date,0,0,1,1)self.forecast_2_type=QtWidgets.QLabel(self.layoutWidget)self.forecast_2_type.setMinimumSize(QtCore.QSize(78,75))self.forecast_2_type.setText(“”)self.forecast_2_type.setScaledContents(True)self.forecast_2_type.setObjectName(“forecast_2_type”)self.gridLayout_3.addWidget(self.forecast_2_type,1,0,1,1)self.forecast_2_temp=QtWidgets.QLabel(self.layoutWidget)self.forecast_2_temp.setMinimumSize(QtCore.QSize(75,20))self.forecast_2_temp.setMaximumSize(QtCore.QSize(200,40))font=QtGui.QFont()font.setFamily(“微软雅黑”)font.setPointSize(8)self.forecast_2_temp.setFont(font)self.forecast_2_temp.setText(“”)self.forecast_2_temp.setAlignment(QtCore.Qt.AlignCenter)self.forecast_2_temp.setObjectName(“forecast_2_temp”)self.gridLayout_3.addWidget(self.forecast_2_temp,2,0,1,1)self.horizontalLayout.addLayout(self.gridLayout_3)self.gridLayout_4=QtWidgets.QGridLayout()self.gridLayout_4.setContentsMargins(11,11,11,11)self.gridLayout_4.setSpacing(6)self.gridLayout_4.setObjectName(“gridLayout_4”)self.forecast_3_date=QtWidgets.QLabel(self.layoutWidget)self.forecast_3_date.setMinimumSize(QtCore.QSize(75,20))self.forecast_3_date.setMaximumSize(QtCore.QSize(200,40))font=QtGui.QFont()font.setFamily(“微软雅黑”)font.setPointSize(8)self.forecast_3_date.setFont(font)self.forecast_3_date.setText(“”)self.forecast_3_date.setAlignment(QtCore.Qt.AlignCenter)self.forecast_3_date.setObjectName(“forecast_3_date”)self.gridLayout_4.addWidget(self.forecast_3_date,0,0,1,1)self.forecast_3_type=QtWidgets.QLabel(self.layoutWidget)self.forecast_3_type.setMinimumSize(QtCore.QSize(78,75))self.forecast_3_type.setText(“”)self.forecast_3_type.setScaledContents(True)self.forecast_3_type.setObjectName(“forecast_3_type”)self.gridLayout_4.addWidget(self.forecast_3_type,1,0,1,1)self.forecast_3_temp=QtWidgets.QLabel(self.layoutWidget)self.forecast_3_temp.setMinimumSize(QtCore.QSize(75,20))self.forecast_3_temp.setMaximumSize(QtCore.QSize(200,40))font=QtGui.QFont()font.setFamily(“微软雅黑”)font.setPointSize(8)self.forecast_3_temp.setFont(font)self.forecast_3_temp.setText(“”)self.forecast_3_temp.setAlignment(QtCore.Qt.AlignCenter)self.forecast_3_temp.setObjectName(“forecast_3_temp”)self.gridLayout_4.addWidget(self.forecast_3_temp,2,0,1,1)self.horizontalLayout.addLayout(self.gridLayout_4)self.gridLayout_5=QtWidgets.QGridLayout()self.gridLayout_5.setContentsMargins(11,11,11,11)self.gridLayout_5.setSpacing(6)self.gridLayout_5.setObjectName(“gridLayout_5”)self.forecast_4_date=QtWidgets.QLabel(self.layoutWidget)self.forecast_4_date.setMinimumSize(QtCore.QSize(75,20))self.forecast_4_date.setMaximumSize(QtCore.QSize(200,40))font=QtGui.QFont()font.setFamily(“微软雅黑”)font.setPointSize(8)self.forecast_4_date.setFont(font)self.forecast_4_date.setText(“”)self.forecast_4_date.setAlignment(QtCore.Qt.AlignCenter)self.forecast_4_date.setObjectName(“forecast_4_date”)self.gridLayout_5.addWidget(self.forecast_4_date,0,0,1,1)self.forecast_4_temp=QtWidgets.QLabel(self.layoutWidget)self.forecast_4_temp.setMinimumSize(QtCore.QSize(75,20))self.forecast_4_temp.setMaximumSize(QtCore.QSize(200,40))font=QtGui.QFont()font.setFamily(“微软雅黑”)font.setPointSize(8)self.forecast_4_temp.setFont(font)self.forecast_4_temp.setText(“”)self.forecast_4_temp.setAlignment(QtCore.Qt.AlignCenter)self.forecast_4_temp.setObjectName(“forecast_4_temp”)self.gridLayout_5.addWidget(self.forecast_4_temp,2,0,1,1)self.forecast_4_type=QtWidgets.QLabel(self.layoutWidget)self.forecast_4_type.setMinimumSize(QtCore.QSize(78,75))self.forecast_4_type.setText(“”)self.forecast_4_type.setScaledContents(True)self.forecast_4_type.setObjectName(“forecast_4_type”)self.gridLayout_5.addWidget(self.forecast_4_type,1,0,1,1)self.horizontalLayout.addLayout(self.gridLayout_5)self.layoutWidget1=QtWidgets.QWidget(self.centralWidget)self.layoutWidget1.setGeometry(QtCore.QRect(10,200,120,55))self.layoutWidget1.setObjectName(“layoutWidget1”)self.gridLayout_7=QtWidgets.QGridLayout(self.layoutWidget1)self.gridLayout_7.setContentsMargins(11,11,11,11)self.gridLayout_7.setSpacing(6)self.gridLayout_7.setObjectName(“gridLayout_7”)self.label_3=QtWidgets.QLabel(self.layoutWidget1)self.label_3.setMinimumSize(QtCore.QSize(30,30))self.label_3.setMaximumSize(QtCore.QSize(60,30))font=QtGui.QFont()font.setPointSize(9)font.setBold(True)font.setWeight(75)self.label_3.setFont(font)self.label_3.setText(“”)self.label_3.setScaledContents(True)self.label_3.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)self.label_3.setObjectName(“label_3”)self.gridLayout_7.addWidget(self.label_3,0,0,1,1)self.shidu=QtWidgets.QLabel(self.layoutWidget1)#self.shidu.setFont(font)self.shidu.setMinimumSize(QtCore.QSize(30,30))self.shidu.setMaximumSize(QtCore.QSize(60,30))font=QtGui.QFont()font.setPointSize(9)font.setBold(False)font.setWeight(50)self.shidu.setFont(font)self.shidu.setText(“”)self.shidu.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)self.shidu.setObjectName(“shidu”)self.gridLayout_7.addWidget(self.shidu,0,1,1,1)self.layoutWidget2=QtWidgets.QWidget(self.centralWidget)self.layoutWidget2.setGeometry(QtCore.QRect(110,200,200,55))self.layoutWidget2.setObjectName(“layoutWidget2”)self.gridLayout_8=QtWidgets.QGridLayout(self.layoutWidget2)self.gridLayout_8.setContentsMargins(11,11,11,11)self.gridLayout_8.setSpacing(6)self.gridLayout_8.setObjectName(“gridLayout_8”)self.fengxiang=QtWidgets.QLabel(self.layoutWidget2)self.fengxiang.setMinimumSize(QtCore.QSize(70,30))self.fengxiang.setMaximumSize(QtCore.QSize(70,30))font=QtGui.QFont()font.setPointSize(9)font.setBold(True)font.setWeight(75)self.fengxiang.setFont(font)self.fengxiang.setText(“”)self.fengxiang.setScaledContents(True)self.fengxiang.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter)self.fengxiang.setObjectName(“fengxiang”)self.gridLayout_8.addWidget(self.fengxiang,0,0,1,1)self.fengli=QtWidgets.QLabel(self.layoutWidget2)self.fengli.setMinimumSize(QtCore.QSize(80,30))self.fengli.setMaximumSize(QtCore.QSize(80,30))font=QtGui.QFont()font.setPointSize(9)font.setBold(False)font.setWeight(50)self.fengli.setFont(font)self.fengli.setText(“”)self.fengli.setObjectName(“fengli”)self.gridLayout_8.addWidget(self.fengli,0,1,1,1)self.webMessageText=QtWebKitWidgets.QWebView(self.centralWidget)self.webMessageText.setGeometry(QtCore.QRect(10,460,331,241))self.webMessageText.setUrl(QtCore.QUrl(“about:bl

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论