2014년 2월 3일 월요일

Python wxpython gui programming / python gui 프로그램 만들기

심심해서 재미삼아 만들어보았다.





import wx

class TestFrame(wx.Frame):
def __init__(self,parent,id,title):
wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition, wx.Size(580,512))
panel = wx.Panel(self,-1,(0,0),(300,400), style=wx.SUNKEN_BORDER)
self.picture=wx.StaticBitmap(panel)
panel.SetBackgroundColour(wx.WHITE)
self.picture.SetFocus()
self.picture.SetBitmap(wx.Bitmap('image/blah.bmp'))

class TestApp(wx.App):
def OnInit(self):
frame = TestFrame(None, -1, "bonjor mango")
frame.CenterOnScreen()
StatusBar = frame.CreateStatusBar()
StatusBar.SetStatusText('haha')

MenuBar = wx.MenuBar()
menu = wx.Menu()
menu.Append(wx.ID_EXIT, 'Exit\tAlt+q', 'exit')
MenuBar.Append(menu, '&General')

menu1 = wx.Menu()
menu1.Append(200, 'Test', 'menu')
menu1.Append(201, 'Copy', 'copy')
menu1.Append(202, 'Paste', 'paste')
MenuBar.Append(menu1, '&Edit')

menu2 = wx.Menu()
menu2.Append(wx.ID_OPEN, 'Open\tCtrl+o', 'open')
MenuBar.Append(menu2,'&fuck')

frame.SetMenuBar(MenuBar)

frame.Show(True)
return True

app = TestApp(0)
app.MainLoop()

댓글 없음:

댓글 쓰기