wxPythonのイベントについて

フォーラム(掲示板)ルール
フォーラム(掲示板)ルールはこちら  ※コードを貼り付ける場合は [code][/code] で囲って下さい。詳しくはこちら
sozai
記事: 57
登録日時: 10年前
住所: 日本-関東
連絡を取る:

wxPythonのイベントについて

#1

投稿記事 by sozai » 10年前

現在、wxPythonでちょっとしたGUIアプリを作っています。
イベントの設定をしようとして以下のようなコードを書いたのですが、関数の引数を
1.()内にそのまま書く
2.その他の手段を使う
のどちらにすればいいのでしょうか。

コード:

import wx

class MyFrame(wx.Frame):
       def __init__(self,parent,title)
             wx.Frame.__init__(self, parent, title=title, size=(300,250))
             self.Menu()
             self.Show(True)
             
             #省略します

class Options:
      def __init__(self,parentFrame):
            self.Option(parentFrame)
      def Option(self,parentFrame):
            #省略します
            self.Layouts(panel)
      def Layouts(self,panel):
            line1 = wx.TextCtrl(parentPanel,wx.ID_ANY)
            #省略します
      Button = wx.Button(parentPanel,wx.ID_ANY,"Run",size = (70,35))
            Button.SetToolTipString(u"実行")
            Button.Bind(wx.EVT_BUTTON,self.buttonEvent) #←この部分です

            self.layoutOption(line1,line2,line3,line4,line5,Button,parentPanel)
            #省略します
            def buttonEvent(self, event):  #←この部分です
                  line1.GetValue()               #←この部分です
            
if __name__=="__main__":
    app = wx.App()

    frame = MyFrame(None, 'title')
    adder = Options(frame)

    app.MainLoop()

1の場合は第一引数のeventにどのような値をとればよいのかも教えてください。
環境はWindows7,Python2.7でエディターはPyScripterです。
[hr]
Is it true?
Function = a==b;

sozai
記事: 57
登録日時: 10年前
住所: 日本-関東
連絡を取る:

Re: wxPythonのイベントについて

#2

投稿記事 by sozai » 10年前

すみません。
自力で解決できました。
本当に申し訳ありませんでした。
[hr]
Is it true?
Function = a==b;

閉鎖

“C言語何でも質問掲示板” へ戻る