forked from PyQt5/PyQt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Main.py
63 lines (48 loc) · 1.38 KB
/
Main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# -*- coding: utf-8 -*-
"""
主函数.
description: pyqt5悬浮下拉菜单
Created on 2018年7月7日
email: [email protected]
"""
from PyQt5 import QtGui, QtWidgets, QtCore
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from Menu import *
from Ui_Main import Ui_MainWindow
#读取CSS用
from CommonHelper import CommonHelper
class MainWindow(QMainWindow, Ui_MainWindow):
"""
Class documentation goes here.
"""
def __init__(self, parent=None):
"""
Constructor
@param parent reference to the parent widget
@type QWidget
"""
super(MainWindow, self).__init__(parent)
self.setupUi(self)
self.showMaximized()
# W1->TestWidget 生成,然后B->,然后L->tablewidget
for i in range(1,10):
try:
txt='''self.W{x}._creatMenu(L{x}, self);
'''.format(x=i)
exec(txt)
except:
continue
def enterEvent(self, e):
'''自定义标题栏需要重置光标。'''
self.setCursor(Qt.ArrowCursor)
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
ui = MainWindow()
styleFile = './style.css'
qssStyle = CommonHelper.readQss( styleFile )
ui.setStyleSheet( qssStyle )
ui.show()
sys.exit(app.exec_())