|
- #!/usr/bin/python
- # -*- coding:utf-8 -*-
- import sys
- from PyQt5 import QtGui
- from PyQt5.QtGui import *
- from PyQt5.QtCore import *
- from PyQt5.QtWidgets import *
- from PyQt5.QtWebKitWidgets import *
- class Form(QWidget):
- def __init__(self, parent=None):
- super(Form, self).__init__(parent)
-
- toolbar_left=2
- toolbar_top=22
- btn_w=120
- btn_h=55
- btn_r=2
- btn_index=0
- rect = QApplication.desktop().screenGeometry()
- self.resize(rect.width(), rect.height())
- self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)
- self.webview = QWebView(self)
- self.webview.resize(rect.width(), rect.height())
- self.webview.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)
-
- #公司名称
- self.label = QLabel(self)
- self.label.setText(u"东莞恩斯克转向器有限公司 ESOP系统V1.0 <font color=red> 東莞エンブレーク転換器有限会社 ESOP システム</font>")
- self.label.move(0,0)
- #按钮开始----------
- btn_index=0
- qbtn_menu=QPushButton(u"菜单选择\nュー選択",self)
- qbtn_menu.setGeometry(toolbar_left+(btn_r+btn_w)*btn_index,toolbar_top,btn_w,btn_h)
- qbtn_menu.setStyleSheet("QPushButton{background-color:#16A085;border:none;color:#ffffff;font-size:20px;}"
- "QPushButton:hover{background-color:#333333;}")
- btn_index=btn_index+1
- qbtn_close=QPushButton(u"退出系统\n閉鎖する",self)
- qbtn_close.setGeometry(toolbar_left+(btn_r+btn_w)*btn_index,toolbar_top,btn_w,btn_h)
- qbtn_close.setStyleSheet("QPushButton{background-color:#D35400;border:none;color:#ffffff;font-size:20px;}"
- "QPushButton:hover{background-color:#333333;}")
- #按钮结束----------
-
- self.showFullScreen() #全屏显示必须放在所有组件画完以后执行
- #注册事件
- qbtn_menu.clicked.connect(self.handleMenu)
- qbtn_close.clicked.connect(self.handleCloseButton)
- def handleCloseButton(self):
- sys.exit(0)
- def handleMenu(self):
- self.webview.load(QUrl("http://192.168.0.254/pdf.js_html/ESOP_Menu.html"))
- self.webview.show()
- def load(self, url):
- syant=0
- #self.webview.load(QUrl(url))
- #self.webview.show()
- if __name__ == '__main__':
- app = QApplication(sys.argv)
- screen = Form()
- screen.show()
- url = "http://192.168.0.254/pdf.js_html/Untitled-1.html"
- screen.load(url)
- sys.exit(app.exec_())
复制代码 |
|