本文整理汇总了Python中PyQt5.Qt.QMainWindow.show方法的典型用法代码示例。如果您正苦于以下问题:Python QMainWindow.show方法的具体用法?Python QMainWindow.show怎么用?Python QMainWindow.show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt5.Qt.QMainWindow
的用法示例。
在下文中一共展示了QMainWindow.show方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test
# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import show [as 别名]
def test(scale=0.5):
from PyQt5.Qt import QLabel, QApplication, QPixmap, QMainWindow, QWidget, QScrollArea, QGridLayout
app = QApplication([])
mi = Metadata('xxx', ['Kovid Goyal', 'John Q. Doe', 'Author'])
mi.series = 'A series of styles'
m = QMainWindow()
sa = QScrollArea(m)
w = QWidget(m)
sa.setWidget(w)
l = QGridLayout(w)
w.setLayout(l), l.setSpacing(30)
labels = []
for r, color in enumerate(sorted(default_color_themes)):
for c, style in enumerate(sorted(all_styles())):
mi.series_index = c + 1
mi.title = 'An algorithmic cover [%s]' % color
prefs = override_prefs(cprefs, override_color_theme=color, override_style=style)
for x in ('cover_width', 'cover_height', 'title_font_size', 'subtitle_font_size', 'footer_font_size'):
prefs[x] = int(scale * prefs[x])
img = generate_cover(mi, prefs=prefs, as_qimage=True)
la = QLabel()
la.setPixmap(QPixmap.fromImage(img))
l.addWidget(la, r, c)
labels.append(la)
m.setCentralWidget(sa)
w.resize(w.sizeHint())
m.show()
app.exec_()
示例2: test
# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import show [as 别名]
def test(scale=0.25):
from PyQt5.Qt import QLabel, QPixmap, QMainWindow, QWidget, QScrollArea, QGridLayout
from calibre.gui2 import Application
app = Application([])
mi = Metadata('Unknown', ['Kovid Goyal', 'John & Doe', 'Author'])
mi.series = 'A series & styles'
m = QMainWindow()
sa = QScrollArea(m)
w = QWidget(m)
sa.setWidget(w)
l = QGridLayout(w)
w.setLayout(l), l.setSpacing(30)
scale *= w.devicePixelRatioF()
labels = []
for r, color in enumerate(sorted(default_color_themes)):
for c, style in enumerate(sorted(all_styles())):
mi.series_index = c + 1
mi.title = 'An algorithmic cover [%s]' % color
prefs = override_prefs(cprefs, override_color_theme=color, override_style=style)
scale_cover(prefs, scale)
img = generate_cover(mi, prefs=prefs, as_qimage=True)
img.setDevicePixelRatio(w.devicePixelRatioF())
la = QLabel()
la.setPixmap(QPixmap.fromImage(img))
l.addWidget(la, r, c)
labels.append(la)
m.setCentralWidget(sa)
w.resize(w.sizeHint())
m.show()
app.exec_()
示例3: main
# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import show [as 别名]
def main():
from calibre.gui2 import Application
from PyQt5.Qt import QMainWindow, QStatusBar, QTimer
app = Application([])
w = QMainWindow()
s = QStatusBar(w)
w.setStatusBar(s)
s.showMessage("Testing ProceedQuestion")
w.show()
p = ProceedQuestion(w)
def doit():
p.dummy_question()
p.dummy_question(action_label="A very long button for testing relayout (indeed)")
p(
lambda p: None,
None,
"ass2",
"ass2",
"testing2",
"testing2",
det_msg="details shown first, with a long line to test wrapping of text and width layout",
show_det=True,
show_ok=True,
)
QTimer.singleShot(10, doit)
app.exec_()
示例4: main
# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import show [as 别名]
def main():
from calibre.gui2 import Application
from PyQt5.Qt import QMainWindow
app = Application([])
w = QMainWindow()
w.show()
p = ProceedQuestion(None)
p(lambda p,q:None, None, 'ass', 'ass', 'testing', 'testing',
checkbox_msg='testing the ruddy checkbox', det_msg='details')
p(lambda p:None, None, 'ass2', 'ass2', 'testing2', 'testing2',
det_msg='details shown first', show_det=True, show_ok=True,
geom_pref='ProceedQuestion-unit-test')
app.exec_()
示例5: test
# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import show [as 别名]
def test():
from PyQt5.Qt import QApplication, QMainWindow
app = QApplication([])
w = QMainWindow()
cf = CoverFlow()
cf.resize(int(available_width()/1.5), available_height()-60)
w.resize(cf.size()+QSize(30, 20))
model = DummyImageList()
cf.setImages(model)
cf.setCurrentSlide(39000)
w.setCentralWidget(cf)
w.show()
cf.setFocus(Qt.OtherFocusReason)
sys.exit(app.exec_())
示例6: WeirdViewClient
# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import show [as 别名]
class WeirdViewClient(QMainWindow):
"""
Weird view client initializer.
"""
def __init__(self):
super().__init__()
self.device_selector_window = QMainWindow()
self.device_selector = DeviceSelector(self.device_selector_window)
self.device_selector.device_selection_signal.connect(self.device_open)
self.device_selector_window.show()
"""
Weird view device open callback.
"""
def device_open(self, name, address):
# Close the old device selector window.
self.device_selector_window.close()
self.plugin_window = QWidget()
self.plugin = PluginWindow(self.plugin_window, name, address)
self.plugin_window.show()
示例7: available_height
# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import show [as 别名]
cf.resize(int(available_width()/1.5), available_height()-60)
w.resize(cf.size()+QSize(30, 20))
model = DummyImageList()
cf.setImages(model)
cf.setCurrentSlide(39000)
w.setCentralWidget(cf)
w.show()
cf.setFocus(Qt.OtherFocusReason)
sys.exit(app.exec_())
def main(args=sys.argv):
return 0
if __name__ == '__main__':
from PyQt5.Qt import QApplication, QMainWindow
app = QApplication([])
w = QMainWindow()
cf = CoverFlow()
cf.resize(int(available_width()/1.5), available_height()-60)
w.resize(cf.size()+QSize(30, 20))
path = sys.argv[1]
model = FileSystemImages(sys.argv[1])
cf.currentChanged[int].connect(model.currentChanged)
cf.setImages(model)
w.setCentralWidget(cf)
w.show()
cf.setFocus(Qt.OtherFocusReason)
sys.exit(app.exec_())
示例8: Application
# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import show [as 别名]
class Application(object):
'''
classdocs
'''
def __init__(self):
'''
Constructor
'''
# logging.config.fileConfig("logging.conf")
self.log = logging.getLogger("Application")
def setupModels(self):
self.mongoResultModel = MongoResultModel()
pass
def setupSlot(self):
self.ui_MainWindow.tableview.setModel(self.mongoResultModel)
self.ui_MainWindow.connectBtn.clicked.connect(self.appctl.connectServer)
self.ui_MainWindow.querybtn.clicked.connect(self.appctl.query)
self.ui_MainWindow.query.returnPressed.connect(self.appctl.query)
self.ui_MainWindow.query.textChanged.connect(self.appctl.queryChange)
self.ui_MainWindow.tableview.clicked.connect(self.appctl.clickTable)
self.add_query_action = QAction("add to query",self.ui_MainWindow.tableview)
self.add_query_action.triggered.connect(self.appctl.addToQuery)
self.ui_MainWindow.tableview.setContextMenuPolicy(Qt.ActionsContextMenu)
self.ui_MainWindow.tableview.addAction(self.add_query_action)
self.tableHeader = self.ui_MainWindow.tableview.horizontalHeader()
self.tableHeader.setSortIndicatorShown(True)
self.tableHeader.sortIndicatorChanged.connect(self.appctl.columnSort)
self.ui_MainWindow.treeWidget.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
self.ui_MainWindow.treeWidget.customContextMenuRequested.connect(self.appctl.showTreeMenu)
self.ui_MainWindow.prevBtn.clicked.connect(self.appctl.prevPagination)
self.ui_MainWindow.nextBtn.clicked.connect(self.appctl.nextPagination)
def setupCtl(self):
self.appctl = AppController(self)
def run(self):
self.log.info("app is start")
self.qtapp = QApplication(sys.argv)
self.setupUi()
self.setupModels()
self.setupCtl()
self.setupSlot()
sys.exit(self.qtapp.exec_())
def setupUi(self):
self.mainWindow = QMainWindow()
self.ui_MainWindow = Ui_MainWindow()
self.ui_MainWindow.setupUi(self.mainWindow)
self.mainWindow.show()
pass
示例9: isinstance
# 需要导入模块: from PyQt5.Qt import QMainWindow [as 别名]
# 或者: from PyQt5.Qt.QMainWindow import show [as 别名]
data.append(serialize_string('FOLDER', initial_folder))
if filename:
if isinstance(filename, bytes):
filename = filename.decode(filesystem_encoding)
data.append(serialize_string('FILENAME', filename))
loop = Loop()
h = Helper(subprocess.Popen(
[HELPER], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE),
data, loop.dialog_closed.emit)
h.start()
loop.exec_(QEventLoop.ExcludeUserInputEvents)
if h.rc != 0:
raise Exception('File dialog failed: ' + h.stderrdata.decode('utf-8'))
if not h.stdoutdata:
return ()
return tuple(x.decode('utf-8') for x in h.stdoutdata.split(b'\0'))
if __name__ == '__main__':
HELPER = sys.argv[-1]
app = QApplication([])
q = QMainWindow()
def clicked():
print(run_file_dialog(b, 'Testing dialogs', save_as=True, save_path='~/xxx.fdgdfg')), sys.stdout.flush()
b = QPushButton('click me')
b.clicked.connect(clicked)
q.setCentralWidget(b)
q.show()
app.exec_()