Skip to content

Instantly share code, notes, and snippets.

@whosaysni
Last active August 8, 2016 15:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whosaysni/22bd7254f93726d80b7dffd9d013e598 to your computer and use it in GitHub Desktop.
Save whosaysni/22bd7254f93726d80b7dffd9d013e598 to your computer and use it in GitHub Desktop.
ボタンを押したら textctrl に表示
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# generated by wxGlade 0.6.8 on Sun Jul 24 23:47:27 2016
#
import wx
import csv
# begin wxGlade: dependencies
import gettext
# end wxGlade
# begin wxGlade: extracode
# end wxGlade
class MyFrame(wx.Frame):
def __init__(self, *args, **kwds):
# begin wxGlade: MyFrame1.__init__
kwds["style"] = wx.DEFAULT_FRAME_STYLE
wx.Frame.__init__(self, *args, **kwds)
self.button_2 = wx.Button(self, wx.ID_ANY, _(u"表示"))
self.text_ctrl_00 = wx.TextCtrl(self, wx.ID_ANY, "")
self.text_ctrl_01 = wx.TextCtrl(self, wx.ID_ANY, "")
self.text_ctrl_02 = wx.TextCtrl(self, wx.ID_ANY, "")
self.text_ctrl_03 = wx.TextCtrl(self, wx.ID_ANY, "")
self.text_ctrl_04 = wx.TextCtrl(self, wx.ID_ANY, "")
self.text_ctrl_05 = wx.TextCtrl(self, wx.ID_ANY, "")
self.text_ctrl_06 = wx.TextCtrl(self, wx.ID_ANY, "")
self.text_ctrl_07 = wx.TextCtrl(self, wx.ID_ANY, "")
self.text_ctrl_08 = wx.TextCtrl(self, wx.ID_ANY, "")
self.Bind(wx.EVT_BUTTON, self.click_button_2, self.button_2)
self.__do_layout()
# end wxGlade
def __do_layout(self):
# begin wxGlade: MyFrame1.__do_layout
sizer_2 = wx.BoxSizer(wx.VERTICAL)
sizer_2.Add(self.button_2, 0, 0, 0)
for i in range(9):
widget = getattr(self, 'text_ctrl_{:02}'.format(i))
sizer_2.Add(widget, 0, 0, 0)
self.SetSizer(sizer_2)
sizer_2.Fit(self)
self.Layout()
# end wxGlade
def click_button_2(self, event):
data = [u'須佐', u'五百蔵', u'鳥橋', u'万丈目',
u'母袋', u'荒巻', u'後藤寺', u'首里', u'王子']
for i in range(9):
widget = getattr(self, 'text_ctrl_{:02}'.format(i))
widget.SetValue(data[i])
# end of class MyFrame1
if __name__ == "__main__":
gettext.install("app") # replace with the appropriate catalog name
app = wx.PySimpleApp(0)
wx.InitAllImageHandlers()
Frame_1 = MyFrame(None, wx.ID_ANY, "")
app.SetTopWindow(Frame_1)
Frame_1.Show()
app.MainLoop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment