本文整理匯總了Python中PyQt5.QtWidgets.QApplication.desktop方法的典型用法代碼示例。如果您正苦於以下問題:Python QApplication.desktop方法的具體用法?Python QApplication.desktop怎麽用?Python QApplication.desktop使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.QtWidgets.QApplication
的用法示例。
在下文中一共展示了QApplication.desktop方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _initUi
# 需要導入模塊: from PyQt5.QtWidgets import QApplication [as 別名]
# 或者: from PyQt5.QtWidgets.QApplication import desktop [as 別名]
def _initUi(self):
self.setWindowTitle('個股資料(F10)')
# 控件
cancelPushButton = QPushButton('Cancel')
okPushButton = QPushButton('OK')
cancelPushButton.clicked.connect(self._cancel)
okPushButton.clicked.connect(self._ok)
self._stockInfoWidget = DyTreeWidget(self.fields)
# 布局
grid = QGridLayout()
grid.setSpacing(10)
grid.addWidget(self._stockInfoWidget, 0, 0, 20, 10)
grid.addWidget(okPushButton, 0, 10)
grid.addWidget(cancelPushButton, 1, 10)
self.setLayout(grid)
self.resize(QApplication.desktop().size().width()//3, QApplication.desktop().size().height()//2)
示例2: _initUi
# 需要導入模塊: from PyQt5.QtWidgets import QApplication [as 別名]
# 或者: from PyQt5.QtWidgets.QApplication import desktop [as 別名]
def _initUi(self):
self.setWindowTitle('選擇哪些傑卡德指數可視化')
# 控件
cancelPushButton = QPushButton('Cancel')
okPushButton = QPushButton('OK')
cancelPushButton.clicked.connect(self._cancel)
okPushButton.clicked.connect(self._ok)
self._jaccardIndexWidget = DyTreeWidget([[x] for x in self._columns])
# 布局
grid = QGridLayout()
grid.setSpacing(10)
grid.addWidget(self._jaccardIndexWidget, 0, 0, 20, 2)
grid.addWidget(okPushButton, 20, 1)
grid.addWidget(cancelPushButton, 20, 0)
self.setLayout(grid)
self.resize(QApplication.desktop().size().width()//6, QApplication.desktop().size().height()//2)
示例3: initUI
# 需要導入模塊: from PyQt5.QtWidgets import QApplication [as 別名]
# 或者: from PyQt5.QtWidgets.QApplication import desktop [as 別名]
def initUI(self):
self.setWindowTitle('File Manager')
self.resize(100, 100)
desktop = QApplication.desktop()
x = int(desktop.width()*0.9) - self.window().width()
y = int(desktop.height()*0.1)
self.move(x, y)
self.setWindowFlags(QtCore.Qt.WindowMinimizeButtonHint | # 使能最小化按鈕
QtCore.Qt.WindowCloseButtonHint | # 使能關閉按鈕
QtCore.Qt.FramelessWindowHint | # 去掉邊框
QtCore.Qt.WindowStaysOnTopHint) # 窗體總在最前端
self.setFixedSize(self.width(), self.height()) # 固定窗體大小
# 設置拖拽事件
self.setAcceptDrops(True)
# 設置背景圖片
self.set_background()
示例4: center
# 需要導入模塊: from PyQt5.QtWidgets import QApplication [as 別名]
# 或者: from PyQt5.QtWidgets.QApplication import desktop [as 別名]
def center(self):
frame = self.frameGeometry()
screen = QApplication.desktop().screenNumber(QApplication.desktop().cursor().pos())
centerPoint = QApplication.desktop().screenGeometry(screen).center()
frame.moveCenter(centerPoint)
self.move(frame.topLeft())
示例5: _initUi
# 需要導入模塊: from PyQt5.QtWidgets import QApplication [as 別名]
# 或者: from PyQt5.QtWidgets.QApplication import desktop [as 別名]
def _initUi(self, title):
self.setWindowTitle(title)
self.setWindowFlags(Qt.Window)
self.resize(QApplication.desktop().size().width()//2, QApplication.desktop().size().height()//2)
self.show()
self.move((QApplication.desktop().size().width() - self.width())//2, (QApplication.desktop().size().height() - self.height())//2)
示例6: _initUi
# 需要導入模塊: from PyQt5.QtWidgets import QApplication [as 別名]
# 或者: from PyQt5.QtWidgets.QApplication import desktop [as 別名]
def _initUi(self, colNames):
self.setWindowTitle('列運算')
# 控件
table = DyTableWidget(parent=None, readOnly=True, index=False, floatCut=True, autoScroll=False)
table.setColNames(['列名', '表達式'])
rows = [[name, 'x[{0}]'.format(i)] for i, name in enumerate(colNames)]
table.fastAppendRows(rows)
descriptionLabel = QLabel('列運算表達式(Pandas語法)')
self._expressionTextEdit = QTextEdit()
cancelPushButton = QPushButton('Cancel')
okPushButton = QPushButton('OK')
cancelPushButton.clicked.connect(self._cancel)
okPushButton.clicked.connect(self._ok)
# 布局
grid = QGridLayout()
grid.setSpacing(10)
grid.addWidget(table, 0, 0, 22, 1)
grid.addWidget(descriptionLabel, 0, 1)
grid.addWidget(self._expressionTextEdit, 1, 1, 20, 20)
grid.addWidget(okPushButton, 0, 21)
grid.addWidget(cancelPushButton, 1, 21)
self.setLayout(grid)
self.resize(QApplication.desktop().size().width()//2, QApplication.desktop().size().height()//4*3)
示例7: _initUi
# 需要導入模塊: from PyQt5.QtWidgets import QApplication [as 別名]
# 或者: from PyQt5.QtWidgets.QApplication import desktop [as 別名]
def _initUi(self, colNames):
self.setWindowTitle('過濾')
# 控件
table = DyTableWidget(parent=None, readOnly=True, index=False, floatCut=True, autoScroll=False)
table.setColNames(['列名', '表達式'])
rows = [[name, 'x[{0}]'.format(i)] for i, name in enumerate(colNames)]
table.fastAppendRows(rows)
descriptionLabel = QLabel('行過濾表達式(Python語法)')
self._filterTextEdit = QTextEdit()
self._newWindowCheckBox = QCheckBox('新窗口')
self._newWindowCheckBox.setChecked(True)
self._highlightCheckBox = QCheckBox('原窗口高亮')
self._highlightCheckBox.setChecked(False)
cancelPushButton = QPushButton('Cancel')
okPushButton = QPushButton('OK')
cancelPushButton.clicked.connect(self._cancel)
okPushButton.clicked.connect(self._ok)
# 布局
grid = QGridLayout()
grid.setSpacing(10)
grid.addWidget(table, 0, 0, 22, 1)
grid.addWidget(self._newWindowCheckBox, 0, 1)
grid.addWidget(self._highlightCheckBox, 0, 2)
grid.addWidget(descriptionLabel, 1, 1)
grid.addWidget(self._filterTextEdit, 2, 1, 20, 20)
grid.addWidget(okPushButton, 0, 21)
grid.addWidget(cancelPushButton, 1, 21)
self.setLayout(grid)
self.resize(QApplication.desktop().size().width()//2, QApplication.desktop().size().height()//4*3)
示例8: _initUi
# 需要導入模塊: from PyQt5.QtWidgets import QApplication [as 別名]
# 或者: from PyQt5.QtWidgets.QApplication import desktop [as 別名]
def _initUi(self, name, baseDate):
self.setWindowTitle('波動分布[{0}]'.format(name))
# 控件
forwardNTDaysLabel = QLabel('基準日期[{0}]向前N日(不包含基準日期)'.format(baseDate))
self._forwardNTDaysLineEdit = QLineEdit('30')
# 自身波動和絕對波動
# 個股絕對波動 = 個股自身波動 + 大盤波動
selfVolatilityRadioButton = QRadioButton('自身波動'); selfVolatilityRadioButton.setChecked(True)
selfVolatilityRadioButton.setToolTip('個股絕對波動 = 個股自身波動 + 大盤波動')
absoluteVolatilityRadioButton = QRadioButton('絕對波動')
absoluteVolatilityRadioButton.setToolTip('個股絕對波動 = 個股自身波動 + 大盤波動')
# 添加到QButtonGroup
self._volatilityButtonGroup = QButtonGroup()
self._volatilityButtonGroup.addButton(selfVolatilityRadioButton, 1);
self._volatilityButtonGroup.addButton(absoluteVolatilityRadioButton, 2)
cancelPushButton = QPushButton('Cancel')
okPushButton = QPushButton('OK')
cancelPushButton.clicked.connect(self._cancel)
okPushButton.clicked.connect(self._ok)
# 布局
grid = QGridLayout()
grid.setSpacing(10)
grid.addWidget(forwardNTDaysLabel, 0, 0)
grid.addWidget(self._forwardNTDaysLineEdit, 0, 1)
grid.addWidget(selfVolatilityRadioButton, 1, 0)
grid.addWidget(absoluteVolatilityRadioButton, 1, 1)
grid.addWidget(okPushButton, 2, 1)
grid.addWidget(cancelPushButton, 2, 0)
self.setLayout(grid)
self.setMinimumWidth(QApplication.desktop().size().width()//5)
示例9: _initUi
# 需要導入模塊: from PyQt5.QtWidgets import QApplication [as 別名]
# 或者: from PyQt5.QtWidgets.QApplication import desktop [as 別名]
def _initUi(self, title, backward):
self.setWindowTitle('添加{0}列'.format(title))
# 控件
increaseColumnsLable = QLabel('基準日期幾日{0}'.format(title))
self._increaseColumnsLineEdit = QLineEdit(','.join([str(x) for x in self._data['days']]) if self._data else '1,2,3,4,5,10')
# 前 & 後
forwardRadioButton = QRadioButton('向前')
backwardRadioButton = QRadioButton('向後')
if backward:
backwardRadioButton.setChecked(True)
else:
forwardRadioButton.setChecked(True)
# 添加到QButtonGroup
self._wardButtonGroup = QButtonGroup()
self._wardButtonGroup.addButton(forwardRadioButton, 1)
self._wardButtonGroup.addButton(backwardRadioButton, 2)
cancelPushButton = QPushButton('Cancel')
okPushButton = QPushButton('OK')
cancelPushButton.clicked.connect(self._cancel)
okPushButton.clicked.connect(self._ok)
# 布局
grid = QGridLayout()
grid.setSpacing(10)
grid.addWidget(increaseColumnsLable, 0, 0, 1, 2)
grid.addWidget(self._increaseColumnsLineEdit, 1, 0, 1, 2)
grid.addWidget(forwardRadioButton, 2, 0)
grid.addWidget(backwardRadioButton, 2, 1)
grid.addWidget(okPushButton, 3, 1)
grid.addWidget(cancelPushButton, 3, 0)
self.setLayout(grid)
self.setMinimumWidth(QApplication.desktop().size().width()//5)
示例10: _initUi
# 需要導入模塊: from PyQt5.QtWidgets import QApplication [as 別名]
# 或者: from PyQt5.QtWidgets.QApplication import desktop [as 別名]
def _initUi(self, name, baseDate):
self.setWindowTitle('行業對比[{0}]-基準日期[{1}]'.format(name, baseDate))
# 控件
forwardNTDaysLabel = QLabel('向前N日漲幅(%)')
self._forwardNTDaysLineEdit = QLineEdit('30')
self._industry2CheckBox = QCheckBox('行業二級分級')
#self._industry2CheckBox.setChecked(True)
self._industry3CheckBox = QCheckBox('行業三級分級')
self._industry3CheckBox.setChecked(True)
cancelPushButton = QPushButton('Cancel')
okPushButton = QPushButton('OK')
cancelPushButton.clicked.connect(self._cancel)
okPushButton.clicked.connect(self._ok)
# 布局
grid = QGridLayout()
grid.setSpacing(10)
grid.addWidget(forwardNTDaysLabel, 0, 0)
grid.addWidget(self._forwardNTDaysLineEdit, 0, 1)
grid.addWidget(self._industry2CheckBox, 1, 0)
grid.addWidget(self._industry3CheckBox, 1, 1)
grid.addWidget(okPushButton, 2, 1)
grid.addWidget(cancelPushButton, 2, 0)
self.setLayout(grid)
self.setMinimumWidth(QApplication.desktop().size().width()//5)
示例11: _limitUpRatioAct
# 需要導入模塊: from PyQt5.QtWidgets import QApplication [as 別名]
# 或者: from PyQt5.QtWidgets.QApplication import desktop [as 別名]
def _limitUpRatioAct(self):
colData = self.getColumnsData([self._rightClickHeaderItem.text()])
limitUpNbr, nonLimitUpNbr = 0, 0
for row in colData:
if row is None:
continue
value = row[0]
try:
value = float(value)
except Exception:
continue
if value >= DyStockCommon.limitUpPct:
limitUpNbr += 1
else:
nonLimitUpNbr += 1
totalNbr = limitUpNbr + nonLimitUpNbr
table = DyTableWidget(readOnly=True, index=False)
table.setColNames(['漲停', '非漲停', '漲停占比(%)'])
table.appendRow([limitUpNbr, nonLimitUpNbr, limitUpNbr/totalNbr*100])
table.setWindowTitle('漲停比')
table.resize(QApplication.desktop().size().width()//2, QApplication.desktop().size().height()//3)
table.show()
self._windows.append(table)
示例12: _upDownRatioAct
# 需要導入模塊: from PyQt5.QtWidgets import QApplication [as 別名]
# 或者: from PyQt5.QtWidgets.QApplication import desktop [as 別名]
def _upDownRatioAct(self):
colData = self.getColumnsData([self._rightClickHeaderItem.text()])
upNbr, downNbr, noChangeNbr = 0, 0, 0
for row in colData:
if row is None:
continue
value = row[0]
try:
value = float(value)
except Exception:
continue
if value > 0:
upNbr += 1
elif value < 0:
downNbr += 1
else:
noChangeNbr += 1
totalNbr = upNbr + downNbr + noChangeNbr
table = DyTableWidget(readOnly=True, index=False)
table.setColNames(['漲', '跌', '平', '上漲占比(%)', '下跌占比(%)', '平占比(%)'])
table.appendRow([upNbr, downNbr, noChangeNbr, upNbr/totalNbr*100, downNbr/totalNbr*100, noChangeNbr/totalNbr*100])
table.setWindowTitle('漲跌比')
table.resize(QApplication.desktop().size().width()//2, QApplication.desktop().size().height()//3)
table.show()
self._windows.append(table)
示例13: _initUi
# 需要導入模塊: from PyQt5.QtWidgets import QApplication [as 別名]
# 或者: from PyQt5.QtWidgets.QApplication import desktop [as 別名]
def _initUi(self):
self.setWindowTitle('要調試的股票')
# 控件
descriptionLabel = QLabel('要調試的股票代碼')
self._codesTextEdit = QTextEdit()
self._codesTextEdit.setPlainText(self._read())
cancelPushButton = QPushButton('Cancel')
okPushButton = QPushButton('OK')
cancelPushButton.clicked.connect(self._cancel)
okPushButton.clicked.connect(self._ok)
# 布局
grid = QGridLayout()
grid.setSpacing(10)
grid.addWidget(descriptionLabel, 0, 0)
grid.addWidget(self._codesTextEdit, 1, 0, 20, 10)
grid.addWidget(okPushButton, 1, 11)
grid.addWidget(cancelPushButton, 2, 11)
self.setLayout(grid)
self.resize(QApplication.desktop().size().width()//3, QApplication.desktop().size().height()//2)
示例14: _initUi
# 需要導入模塊: from PyQt5.QtWidgets import QApplication [as 別名]
# 或者: from PyQt5.QtWidgets.QApplication import desktop [as 別名]
def _initUi(self, title):
self.setWindowTitle('添加{0}列'.format(title))
# 控件
increaseColumnsLable = QLabel('基準日期幾日{0}'.format(title))
self._increaseColumnsLineEdit = QLineEdit(','.join(self._data['days']) if self._data else '1,2,3,4,5,10')
# 前 & 後
forwardRadioButton = QRadioButton('向前')
backwardRadioButton = QRadioButton('向後'); backwardRadioButton.setChecked(True)
# 添加到QButtonGroup
self._wardButtonGroup = QButtonGroup()
self._wardButtonGroup.addButton(forwardRadioButton, 1);
self._wardButtonGroup.addButton(backwardRadioButton, 2)
cancelPushButton = QPushButton('Cancel')
okPushButton = QPushButton('OK')
cancelPushButton.clicked.connect(self._cancel)
okPushButton.clicked.connect(self._ok)
# 布局
grid = QGridLayout()
grid.setSpacing(10)
grid.addWidget(increaseColumnsLable, 0, 0, 1, 2)
grid.addWidget(self._increaseColumnsLineEdit, 1, 0, 1, 2)
grid.addWidget(forwardRadioButton, 2, 0)
grid.addWidget(backwardRadioButton, 2, 1)
grid.addWidget(okPushButton, 3, 1)
grid.addWidget(cancelPushButton, 3, 0)
self.setLayout(grid)
self.setMinimumWidth(QApplication.desktop().size().width()//5)
示例15: _initUi
# 需要導入模塊: from PyQt5.QtWidgets import QApplication [as 別名]
# 或者: from PyQt5.QtWidgets.QApplication import desktop [as 別名]
def _initUi(self, strategyName):
self.setWindowTitle('[{0}]另存為'.format(strategyName))
allRadioButton = QRadioButton('所有'); allRadioButton.setChecked(True)
highlightRadioButton = QRadioButton('高亮')
# 添加到QButtonGroup
self._buttonGroup = QButtonGroup()
self._buttonGroup.addButton(allRadioButton, 1);
self._buttonGroup.addButton(highlightRadioButton, 2)
cancelPushButton = QPushButton('Cancel')
okPushButton = QPushButton('OK')
cancelPushButton.clicked.connect(self._cancel)
okPushButton.clicked.connect(self._ok)
# 布局
grid = QGridLayout()
grid.setSpacing(10)
grid.addWidget(allRadioButton, 1, 0)
grid.addWidget(highlightRadioButton, 1, 1)
grid.addWidget(okPushButton, 2, 1)
grid.addWidget(cancelPushButton, 2, 0)
self.setLayout(grid)
self.setMinimumWidth(QApplication.desktop().size().width()//5)