Skip to content

Instantly share code, notes, and snippets.

@tai-sho
Created December 14, 2014 14:27
Show Gist options
  • Save tai-sho/75819d51510f8701fbb2 to your computer and use it in GitHub Desktop.
Save tai-sho/75819d51510f8701fbb2 to your computer and use it in GitHub Desktop.
wxPythonでGUIアプリケーションを作成するサンプル
# -*- coding: cp932 -*-
import wx
class MyFrame(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, title=title, size=(500,500),pos=(10,10))
#ステータスバー
self.CreateStatusBar()
#ファイルメニュー
filemenu = wx.Menu()
filemenu.Append(wx.ID_NEW, '&New', 'create new project')
filemenu.Append(wx.ID_OPEN, '&Open', 'open project')
filemenu.AppendSeparator()
#編集メニュー
editmenu = wx.Menu()
editmenu.Append(wx.ID_CUT, '&Cut', 'cut strings')
editmenu.Append(wx.ID_COPY, '&Copy', 'copy strings')
#メニュ-バーの作成
menuBar = wx.MenuBar()
#ファイルメニューを登録
menuBar.Append(filemenu, '&File')
#編集メニューを登録
menuBar.Append(editmenu, '&Edit')
self.SetMenuBar(menuBar)
self.Show(True)
application = wx.App(False)
frame = MyFrame(None, 'TestApplication')
application.MainLoop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment