フォームにツールバーをつける
2009/11/8
wxPython2.8.9.2
import wx
def main():
app = wx.App()
frame = wx.Frame(parent=None)
im_new = wx.ArtProvider.GetBitmap(wx.ART_NEW,wx.ART_TOOLBAR,(15,15))
im_open = wx.ArtProvider.GetBitmap(wx.ART_FILE_OPEN,wx.ART_TOOLBAR,(15,15))
im_save = wx.ArtProvider.GetBitmap(wx.ART_FILE_SAVE,wx.ART_TOOLBAR,(15,15))
toolbar = frame.CreateToolBar()
toolbar.AddSimpleTool(wx.ID_NEW ,im_new,"Create new file")
toolbar.AddSimpleTool(wx.ID_OPEN,im_open,"Open file")
toolbar.AddSimpleTool(wx.ID_SAVE,im_save,"Open file")
toolbar.Realize()
frame.Show()
app.MainLoop()
if __name__ == '__main__':
main()
・Simpleじゃないのは・・・、わからん ・frame.Bind(ID,def_nanka)でイベントを拾う