深圳全飞鸿

标题: kk-v2.py的源码 [打印本页]

作者: syant    时间: 2019-6-17 23:46
标题: kk-v2.py的源码
  1. #!/usr/bin/python
  2. # -*- coding:utf-8 -*-

  3. import sys
  4. from PyQt5 import QtGui
  5. from PyQt5.QtGui import *
  6. from PyQt5.QtCore import *
  7. from PyQt5.QtWidgets import *
  8. from PyQt5.QtWebKitWidgets import *

  9. class Form(QWidget):
  10.     def __init__(self, parent=None):
  11.         super(Form, self).__init__(parent)
  12.         
  13.         toolbar_left=2
  14.         toolbar_top=22
  15.         btn_w=120
  16.         btn_h=55
  17.         btn_r=2
  18.         btn_index=0


  19.         rect = QApplication.desktop().screenGeometry()
  20.         self.resize(rect.width(), rect.height())
  21.         self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)

  22.         self.webview = QWebView(self)
  23.         self.webview.resize(rect.width(), rect.height())
  24.         self.webview.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)
  25.         
  26.         #公司名称
  27.         self.label = QLabel(self)        
  28.         self.label.setText(u"东莞恩斯克转向器有限公司 ESOP系统V1.0  &nbsp;&nbsp;&nbsp; <font color=red>  東莞エンブレーク転換器有限会社 ESOP システム</font>")
  29.         self.label.move(0,0)


  30.         #按钮开始----------
  31.         btn_index=0
  32.         qbtn_menu=QPushButton(u"菜单选择\nュー選択",self)
  33.         qbtn_menu.setGeometry(toolbar_left+(btn_r+btn_w)*btn_index,toolbar_top,btn_w,btn_h)
  34.         qbtn_menu.setStyleSheet("QPushButton{background-color:#16A085;border:none;color:#ffffff;font-size:20px;}"
  35.                                "QPushButton:hover{background-color:#333333;}")

  36.         btn_index=btn_index+1
  37.         qbtn_close=QPushButton(u"退出系统\n閉鎖する",self)
  38.         qbtn_close.setGeometry(toolbar_left+(btn_r+btn_w)*btn_index,toolbar_top,btn_w,btn_h)
  39.         qbtn_close.setStyleSheet("QPushButton{background-color:#D35400;border:none;color:#ffffff;font-size:20px;}"
  40.                                  "QPushButton:hover{background-color:#333333;}")
  41.         #按钮结束----------
  42.         

  43.         self.showFullScreen()    #全屏显示必须放在所有组件画完以后执行
  44.         #注册事件
  45.         qbtn_menu.clicked.connect(self.handleMenu)
  46.         qbtn_close.clicked.connect(self.handleCloseButton)

  47.     def handleCloseButton(self):
  48.         sys.exit(0)
  49.     def handleMenu(self):
  50.         self.webview.load(QUrl("http://192.168.0.254/pdf.js_html/ESOP_Menu.html"))
  51.         self.webview.show()      


  52.     def load(self, url):
  53.         syant=0
  54.         #self.webview.load(QUrl(url))
  55.         #self.webview.show()

  56. if __name__ == '__main__':
  57.     app = QApplication(sys.argv)
  58.     screen = Form()
  59.     screen.show()
  60.     url = "http://192.168.0.254/pdf.js_html/Untitled-1.html"

  61.     screen.load(url)
  62.     sys.exit(app.exec_())

复制代码





欢迎光临 深圳全飞鸿 (http://www.nagomes.com/disc/) Powered by Discuz! X3.2