lang:python:wxpython:event
差分
このページの2つのバージョン間の差分を表示します。
次のリビジョン | 前のリビジョン | ||
lang:python:wxpython:event [2025/08/17 09:49] – 作成 editor | lang:python:wxpython:event [2025/08/17 09:54] (現在) – editor | ||
---|---|---|---|
行 10: | 行 10: | ||
| | ||
def onButton1(self, | def onButton1(self, | ||
- | print ("push Button1" | + | print ("pushed: |
def onButton2(self, | def onButton2(self, | ||
- | print ("push Button2" | + | print ("pushed: |
==== 別の例 ==== | ==== 別の例 ==== | ||
- | widgets | + | widgets |
+ | こちらのほうが個人的には、好みである。 | ||
button1 = wx.Button(self, | button1 = wx.Button(self, | ||
行 27: | 行 28: | ||
print (" | print (" | ||
- | 例 | + | Bind を frame などで設定することも可能。これを知る前は、 |
+ | 各 panel など 各 widgets を Bind していた。 | ||
+ | さらに、その event を上位の panel で処理する場合、 | ||
+ | 引数で与えたりしていたが、それが必要なくなる。 | ||
+ | |||
+ | **例** | ||
<file python buttonEvent.py> | <file python buttonEvent.py> | ||
import os | import os | ||
行 47: | 行 53: | ||
def onButton(self, | def onButton(self, | ||
buttonObject = event.GetEventObject() | buttonObject = event.GetEventObject() | ||
- | print ("push: ", buttonObject.GetName()) | + | print ("pushed: ", buttonObject.GetName()) |
| | ||
lang/python/wxpython/event.1755424140.txt.gz · 最終更新: by editor