본문 바로가기

Language/Python

[wxPython] wx.Button(버튼) 만들기

본 내용의 출처는 이글루 블로그의 '하린아빠' 라는 네임을 쓰시는 분의 블로그입니다.

[출처] - http://pythondev.egloos.com/90018


행여나 이글루 블로그가 없어지면 참고할 곳이 사라지기에 주인장님께 댓글을 남기고 퍼 옵니다.



출처: http://slays.tistory.com/18 [Reverse Engineering]




[wxPython] wx.Button(버튼) 만들기


#!/usr/bin/python
# -*- coding: cp949 -*-
# layout.py

import wx

class MyFrame(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title, wx.DefaultPosition, wx.Size(250, 60))

        # 패널 생성
        panel = wx.Panel(self, -1)
        # 버튼 생성
        wx.Button(panel, -1, "Button1", (0,0))
        wx.Button(panel, -1, "Button2", (80,0))
        wx.Button(panel, -1, "Button3", (160, 0))

class MyApp(wx.App):
    def OnInit(self):
        frame = MyFrame(None, -1, 'layout.py')
        frame.Show(True)
        frame.Center()
        return True


app = wx.App()
mainapp = MyApp(app)
mainapp.MainLoop()

[실행 화면]