wxPython : GridSizer について
前と同じようにこのサイトを参考に、
Button(wxPython) - Python入門から応用までの学習サイト
ボタンにイベントを設定しようとしたところ
layout = wx.GridSizer(2.0, 2.0)
TypeError: GridSizer(): arguments did not match any overloaded call:
overload 1: not enough arguments
overload 2: argument 2 has unexpected type 'float'
overload 3: not enough arguments
overload 4: not enough arguments
このように怒られてしまいました。
そのままグーグルに聞くと、
wxpython - TypeError: GridSizer(): arguments did not match any overloaded call - Stack Overflow
おそらく同じエラーの人が。
ここから引用する限り
「As you are running Python 3.4 I presume you are using wxPython Phoenix. According to the documentation of wx.GridSizer
two int
do not match any of the allowed signatures. Use e.g. three integers instead」
とのことです。
GridSizerには引数が3つ必要ってことかな?と思い、適当に
GridSizer(2,2,2)とすることで解決。
3つ目の引数なんだ?と思ったけど、最初の二つもよくわかってないことに気づいたため、調べてみることに。
すぐにヒットしました。
どうやら引数自体は3つだけでなく4つまで取れるようで、縦と横の間隔を指定するそうです。
一件落着。