ユーザ用ツール

サイト用ツール


lang:python:wxpython:event

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

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

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki