close
Warning:
Can't synchronize with repository "(default)" (Unsupported version control system "svn": libsvn_fs_base-1.so.1: failed to map segment from shared object: Cannot allocate memory). Look in the Trac log for more information.
- Timestamp:
-
Oct 14, 2011, 1:16:26 AM (15 years ago)
- Author:
-
wade
- Comment:
-
--
Legend:
- Unmodified
- Added
- Removed
- Modified
-
|
v14
|
v15
|
|
| 15 | 15 | * Python |
| 16 | 16 | * !PySide 1.07 |
| 17 | | 2. 測試: |
| | 17 | 1. 測試: |
| 18 | 18 | {{{ |
| 19 | 19 | #!python |
| … |
… |
|
| 24 | 24 | 結果:1.0.7 |
| 25 | 25 | |
| 26 | | 3. 第一個 Hello World GUI 程式: |
| | 26 | 1. 第一個 Hello World GUI 程式: |
| 27 | 27 | {{{ |
| 28 | 28 | #!python |
| … |
… |
|
| 49 | 49 | }}} |
| 50 | 50 | |
| | 51 | 1. 第二個程式,加入connect與程式連結: |
| | 52 | {{{ |
| | 53 | #!python |
| | 54 | |
| | 55 | #!/usr/bin/python |
| | 56 | # 載入 PySide classes |
| | 57 | import sys |
| | 58 | from PySide.QtCore import * |
| | 59 | from PySide.QtGui import * |
| | 60 | |
| | 61 | # 定義一個 say_hello 的 subroutine,這個 subroutine 會印出 Hellow World |
| | 62 | def say_hello(): |
| | 63 | print 'Hellow World' |
| | 64 | |
| | 65 | # 建立 Qt 應用程式 |
| | 66 | app = QApplication(sys.argv) |
| | 67 | # 新增一個 button |
| | 68 | button = QPushButton('test') |
| | 69 | # 將 button 與 say_hello 連結 |
| | 70 | button.clicked.connect(say_hello) |
| | 71 | # 讓 button 顯示出來 |
| | 72 | button.show() |
| | 73 | # 執行 Qt 應用程式的 main loop |
| | 74 | app.exec_() |
| | 75 | sys.exit() |
| | 76 | }}} |
| | 77 | |
| 51 | 78 | |
| 52 | 79 | = Reference = |