ページ 11

wxPythonのイベントについて

Posted: 2013年8月28日(水) 05:22
by sozai
現在、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です。

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

Posted: 2013年8月31日(土) 03:56
by sozai
すみません。
自力で解決できました。
本当に申し訳ありませんでした。