티스토리 뷰
PySide - About Box
about.ui
<?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>MainWindow</class> <widget class="QMainWindow" name="MainWindow"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>654</width> <height>467</height> </rect> </property> <property name="windowTitle"> <string>MainWindow</string> </property> <widget class="QWidget" name="centralwidget"> <layout class="QGridLayout" name="gridLayout"> <item row="0" column="0"> <widget class="QPushButton" name="aboutButton"> <property name="text"> <string>&About</string> </property> </widget> </item> <item row="0" column="1"> <spacer name="horizontalSpacer"> <property name="orientation"> <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>548</width> <height>26</height> </size> </property> </spacer> </item> <item row="1" column="0"> <spacer name="verticalSpacer"> <property name="orientation"> <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> <width>20</width> <height>355</height> </size> </property> </spacer> </item> </layout> </widget> <widget class="QMenuBar" name="menubar"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>654</width> <height>29</height> </rect> </property> </widget> <widget class="QStatusBar" name="statusbar"/> </widget> <resources/> <connections/> </ui> | cs |
$ pyside-uic about.ui > ui_about.py
about.py
#!/usr/bin/python # -*- coding: utf-8 -*- # about.py - display about box with info on platform etc. import sys import platform import PySide from PySide.QtGui import (QApplication, QMainWindow, QMessageBox) from ui_about import Ui_MainWindow __version__ = '1.0.0' class MainWindow(QMainWindow, Ui_MainWindow): def __init__(self, parent=None): super(MainWindow, self).__init__(parent) self.setupUi(self) self.resize(600, 250) self.aboutButton.clicked.connect(self.about) def about(self): '''Popup a box with about message.''' QMessageBox.about(self, "About PySide, Platform and version.", """<b> about.py version %s </b> <p>Copyright © 2015 by do9dark. <p>This application is useful for displaying Qt version and other details. <p>Python %s - PySide version %s - Qt version %s on %s""" % (__version__, platform.python_version(), PySide.__version__, PySide.QtCore.__version__, platform.system())) if __name__ == '__main__': app = QApplication(sys.argv) frame = MainWindow() frame.show() sys.exit(app.exec_()) | cs |
'Programming > Python' 카테고리의 다른 글
(PEP 8) Style Guide for Python Code (0) | 2016.08.15 |
---|---|
Python Modules (0) | 2016.01.16 |
Scapy 사용하기 (0) | 2015.04.11 |
Scapy 설치하기 (0) | 2015.04.11 |
PySide - Combine (Show, About, Close) (0) | 2015.04.07 |
PySide - Show Licence (File Open) (0) | 2015.04.07 |
PySide - Close Button (0) | 2015.04.05 |
PySide - QMessageBox (0) | 2015.04.05 |
OS X에서 PySide 설치하기 (0) | 2015.04.05 |
쉘 스크립트(shell script)의 시작 #!(shebang) (0) | 2014.11.14 |
댓글