本文整理汇总了Python中PyQt4.QtGui.QDesktopWidget.center方法的典型用法代码示例。如果您正苦于以下问题:Python QDesktopWidget.center方法的具体用法?Python QDesktopWidget.center怎么用?Python QDesktopWidget.center使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyQt4.QtGui.QDesktopWidget
的用法示例。
在下文中一共展示了QDesktopWidget.center方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: signal
# 需要导入模块: from PyQt4.QtGui import QDesktopWidget [as 别名]
# 或者: from PyQt4.QtGui.QDesktopWidget import center [as 别名]
from sys import argv
from sys import exit
if __name__ == "__main__":
# The following command allows the user to kill the app with crtl-c.
signal(SIGINT, SIG_DFL)
# Creating the Gui
app = QApplication(argv)
main_window = QMainWindow()
screen = QDesktopWidget().screenGeometry(1)
ui = Ui_Booklet()
ui.setupUi(main_window)
# Adjusting to the middle of the screen.
main_window.move(screen.center() - main_window.frameGeometry().center())
viewer = BookletViewer(ui)
# Connecting Signals and Slots.
ui.actionOpen.triggered.connect(viewer.open_pdf)
ui.actionSave.triggered.connect(viewer.save_pdf)
ui.actionPrint.triggered.connect(viewer.print_pdf)
ui.actionAbout.triggered.connect(viewer.open_about)
ui.actionFirst.triggered.connect(viewer.go_first)
ui.actionNext.triggered.connect(viewer.go_next)
ui.actionPrevious.triggered.connect(viewer.go_previous)
ui.actionLast.triggered.connect(viewer.go_last)
# Running the Application.
main_window.resizeEvent = viewer.onResize
main_window.show()