Created
March 31, 2012 08:45
-
-
Save ikeikeikeike/2260968 to your computer and use it in GitHub Desktop.
QTextEdit at GUI
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| from PySide.QtGui import (QMainWindow, QWidget, QApplication, QVBoxLayout, QTextEdit, | |
| QPushButton, QDesktopServices) | |
| from PySide.QtCore import QObject, SIGNAL | |
| import sys | |
| class MyMainWindow(QMainWindow): | |
| """ main """ | |
| def __init__(self, MainWindow, *args, **kwargs): | |
| super(type(self), self).__init__(*args, **kwargs) | |
| MainWindow.setWindowTitle("Window") | |
| MainWindow.resize(450, 500) | |
| MainWindow.show() | |
| self.initui() | |
| def initui(self): | |
| self.centralwidget = QWidget() | |
| self.vlbox_1 = QVBoxLayout(self.centralwidget) | |
| self.vlbox_2 = QVBoxLayout() | |
| self.widgets1() | |
| def widgets1(self): | |
| self.textEdit = QTextEdit(self.centralwidget) | |
| self.vlbox_2.addWidget(self.textEdit) | |
| self.btn_help = QPushButton("Help", self.centralwidget) | |
| self.vlbox_2.addWidget(self.btn_help) | |
| self.vlbox_1.addLayout(self.vlbox_2) | |
| MainWindow.setCentralWidget(self.centralwidget) | |
| self.access() | |
| def access(self): | |
| QObject.connect(self.btn_help, SIGNAL("clicked()"), self.helpurl) | |
| def helpurl(self): | |
| QDesktopServices.openUrl("http://www.pyside.org/docs/pyside/PySide/QtGui/QTextEdit.html#pyside-qtgui-qtextedit-editing-key-bindings") | |
| if __name__ == '__main__': | |
| app = QApplication(sys.argv) | |
| MainWindow = QMainWindow() | |
| ui = MyMainWindow(MainWindow) | |
| sys.exit(app.exec_()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment