回答編集履歴

1

別解を追加

2017/03/04 08:06

投稿

8524ba23
8524ba23

スコア38352

test CHANGED
@@ -29,3 +29,35 @@
29
29
 
30
30
 
31
31
  ```
32
+
33
+
34
+
35
+ 別解。コントロールにIDを振りアクセスする例です。
36
+
37
+ ```Python
38
+
39
+ def __init__(self):
40
+
41
+
42
+
43
+ self.__CID_PATH = 10 # パスTextCtrl
44
+
45
+
46
+
47
+ tc = wx.TextCtrl(root_panel, self.__CID_PATH) # IDを指定
48
+
49
+
50
+
51
+ def onOpenFile(self, event):
52
+
53
+
54
+
55
+ if dlg.ShowModal() == wx.ID_OK:
56
+
57
+ path = dlg.GetPath() # GetPaths -> GetPathに
58
+
59
+ wnd = self.FindWindowById(self.__CID_PATH) # IDからコントロール取得
60
+
61
+ wnd.SetValue(path)
62
+
63
+ ```