本文整理匯總了Python中PyQt5.QtWidgets.QMainWindow方法的典型用法代碼示例。如果您正苦於以下問題:Python QtWidgets.QMainWindow方法的具體用法?Python QtWidgets.QMainWindow怎麽用?Python QtWidgets.QMainWindow使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類PyQt5.QtWidgets
的用法示例。
在下文中一共展示了QtWidgets.QMainWindow方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QMainWindow [as 別名]
def __init__(self):
self.evalDialog = QtWidgets.QMainWindow()
self.new_screen = Form()
self.new_screen.setupUi(self.evalDialog)
self.EvaluateWindow= QtWidgets.QMainWindow()
self.eval_screen= Box()
self.eval_screen.setupUi(self.EvaluateWindow)
self.openDialog = QtWidgets.QMainWindow()
self.open_screen= Ui_OpenWindow()
self.open_screen.setupUi(self.openDialog)
self.scoreDialog = QtWidgets.QMainWindow()
self.score_screen= Ui_ScoreWindow()
self.score_screen.setupUi(self.scoreDialog)
示例2: __init__
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QMainWindow [as 別名]
def __init__(self, app, SHOW_MQ, TRAY_MQ, ALARM_MQ, MALWARE_MQ, EXCEPTION_RULES):
QtWidgets.QMainWindow.__init__(self)
self.app = app
self.some_widget = QtWidgets.QWidget()
screen_resolution = self.app.desktop().screenGeometry()
self.screen_width, self.screen_height = screen_resolution.width(), screen_resolution.height()
self.dialog_controls = dict()
self.SHOW_MQ = SHOW_MQ
self.TRAY_MQ = TRAY_MQ
self.ALARM_MQ = ALARM_MQ
self.MALWARE_MQ = MALWARE_MQ
self.EXCEPTION_RULES = EXCEPTION_RULES
# GET GUI CONFIG
self.cc = configer.Config()
gui_options = self.cc.get_config_single_category(configer.MAIN_CONFIG, "gui")
if gui_options['learning_mode']:
self.LEARNING_MODE = True
else:
self.LEARNING_MODE = False
示例3: __init__
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QMainWindow [as 別名]
def __init__(self):
Ui_SubCrawl.__init__(self)
QtWidgets.QMainWindow.__init__(self)
self.setupUi(self)
# TODO: Implement enabling and disabling of buttons depending on the confirmation of selection
self.selection_confirmed = False
self.program_dir = os.getcwd()
self.total_files = 0
self.subtitle_preference = SubtitlePreference()
self.interactor = _DBInteractor(self.program_dir)
self.interactor.check_if_entries_exist()
self._populate_table()
self.subtitle_downloader = SubtitleDownloader(self.subtitle_preference, self.PromptLabel,
self.ProgressBar, self.interactor)
示例4: eventFilter
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QMainWindow [as 別名]
def eventFilter(self, obj, event):
if event.type() == QtCore.QEvent.ActivationChange and self.isActiveWindow():
self.focusInEvent(event)
if event.type() == QtCore.QEvent.KeyPress:
# Ctrl + <n>
modifiers = QtWidgets.QApplication.keyboardModifiers()
if modifiers == QtCore.Qt.ControlModifier:
if event.key() == QtCore.Qt.Key_1: self.leftPane.click(0)
elif event.key() == QtCore.Qt.Key_2: self.leftPane.click(1)
elif event.key() == QtCore.Qt.Key_3: self.leftPane.click(2)
elif event.key() == QtCore.Qt.Key_4: self.leftPane.click(3)
elif event.key() == QtCore.Qt.Key_5: self.leftPane.click(4)
elif event.key() == QtCore.Qt.Key_6: self.leftPane.click(5)
elif event.key() == QtCore.Qt.Key_7: self.leftPane.click(6)
elif event.key() == QtCore.Qt.Key_8: self.leftPane.click(7)
elif event.key() == QtCore.Qt.Key_9: self.leftPane.click(8)
# Ctrl + Tab
elif event.key() == QtCore.Qt.Key_Tab: self.leftPane.clickNext(1)
# Ctrl + BackTab
if (modifiers & QtCore.Qt.ControlModifier) and (modifiers & QtCore.Qt.ShiftModifier):
if event.key() == QtCore.Qt.Key_Backtab: self.leftPane.clickNext(-1)
# Ctrl + Shift + <key>
if (modifiers & QtCore.Qt.ShiftModifier) and (modifiers & QtCore.Qt.ShiftModifier):
if event.key() == QtCore.Qt.Key_V: self.current().createSnippet()
return QtWidgets.QMainWindow.eventFilter(self, obj, event);
示例5: setMainWindowConfig
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QMainWindow [as 別名]
def setMainWindowConfig(config=None):
"""Set config as current project"""
global currentConfig
if config:
currentConfig = config
return
else:
widget = QtWidgets.QApplication.activeWindow()
if isinstance(widget, QtWidgets.QMainWindow) and \
widget.__class__.__name__ == "UI_pychemqt":
currentConfig = widget.currentConfig
else:
lista = QtWidgets.QApplication.topLevelWidgets()
for widget in lista:
if isinstance(widget, QtWidgets.QMainWindow) and \
widget.__class__.__name__ == "UI_pychemqt":
currentConfig = widget.currentConfig
break
示例6: qui_menubar
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QMainWindow [as 別名]
def qui_menubar(self, menu_list_str):
if not isinstance(self, QtWidgets.QMainWindow):
print("Warning: Only QMainWindow can have menu bar.")
return
menubar = self.menuBar()
create_opt_list = [ x.strip() for x in menu_list_str.split('|') ]
for each_creation in create_opt_list:
ui_info = [ x.strip() for x in each_creation.split(';') ]
menu_name = ui_info[0]
menu_title = ''
if len(ui_info) > 1:
menu_title = ui_info[1]
if menu_name not in self.uiList.keys():
self.uiList[menu_name] = QtWidgets.QMenu(menu_title)
menubar.addMenu(self.uiList[menu_name])
#=======================================
# ui creation functions
#=======================================
示例7: qui_menubar
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QMainWindow [as 別名]
def qui_menubar(self, menu_list_str):
if not isinstance(self, QtWidgets.QMainWindow):
print("Warning: Only QMainWindow can have menu bar.")
return
menubar = self.menuBar()
create_opt_list = [ x.strip() for x in menu_list_str.split('|') ]
for each_creation in create_opt_list:
ui_info = [ x.strip() for x in each_creation.split(';') ]
menu_name = ui_info[0]
menu_title = ''
if len(ui_info) > 1:
menu_title = ui_info[1]
if menu_name not in self.uiList.keys():
self.uiList[menu_name] = QtWidgets.QMenu(menu_title)
menubar.addMenu(self.uiList[menu_name])
# compatible hold function
示例8: __init__
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QMainWindow [as 別名]
def __init__(self, ):
super(QtWidgets.QMainWindow,self).__init__()
self.resize(300, 200)
self.setWindowTitle('Test')
foo = ImageProcessorListView([
imageprocessor.BlurProcessor(),
imageprocessor.FFTProcessor()
])
foo.add_image_processor(imageprocessor.BlurProcessor())
def myfunc(data,para=1.):
print("myfunc with para", para)
return data*para
imp = imageprocessor.FuncProcessor(myfunc,"myfunc",para=.1)
foo.add_image_processor(imp)
self.setCentralWidget(foo)
self.setStyleSheet("background-color:black;")
示例9: __init__
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QMainWindow [as 別名]
def __init__(self):
QtWidgets.QMainWindow.__init__(self)
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
示例10: main
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QMainWindow [as 別名]
def main():
"""
Application entry point
"""
logging.basicConfig(level=logging.DEBUG)
# create the application and the main window
app = QtWidgets.QApplication(sys.argv)
#app.setStyle(QtWidgets.QStyleFactory.create("fusion"))
window = QtWidgets.QMainWindow()
# setup ui
ui = example.Ui_MainWindow()
ui.setupUi(window)
ui.bt_delay_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
ui.bt_instant_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
ui.bt_menu_button_popup.addActions([
ui.actionAction,
ui.actionAction_C
])
window.setWindowTitle("Native example")
# tabify dock widgets to show bug #6
window.tabifyDockWidget(ui.dockWidget1, ui.dockWidget2)
# auto quit after 2s when testing on travis-ci
if "--travis" in sys.argv:
QtCore.QTimer.singleShot(2000, app.exit)
# run
window.show()
app.exec_()
示例11: myHello
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QMainWindow [as 別名]
def myHello(self):
print('call received')
return 'hello, Python'
# class MainWindow(QMainWindow):
示例12: main
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QMainWindow [as 別名]
def main():
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = DottorrentGUI()
ui.setupUi(MainWindow)
MainWindow.setWindowTitle(PROGRAM_NAME_VERSION)
ui.loadSettings()
ui.clipboard = app.clipboard
app.aboutToQuit.connect(lambda: ui.saveSettings())
MainWindow.show()
sys.exit(app.exec_())
示例13: __init__
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QMainWindow [as 別名]
def __init__(self, parent = None):
QtWidgets.QMainWindow.__init__(self,parent)
self.filename = ""
self.initUI()
示例14: __init__
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QMainWindow [as 別名]
def __init__(self,parent=None):
QtWidgets.QMainWindow.__init__(self,parent)
self.filename = ""
self.initUI()
示例15: __init__
# 需要導入模塊: from PyQt5 import QtWidgets [as 別名]
# 或者: from PyQt5.QtWidgets import QMainWindow [as 別名]
def __init__(self,parent=None):
QtWidgets.QMainWindow.__init__(self,parent)
self.filename = ""
self.changesSaved = True
self.initUI()