본 내용의 출처는 이글루 블로그의 '하린아빠' 라는 네임을 쓰시는 분의 블로그입니다.
[출처] - http://pythondev.egloos.com/109496
행여나 이글루 블로그가 없어지면 참고할 곳이 사라지기에 주인장님께 댓글을 남기고 퍼 옵니다.
[wxPython] wx.CheckBox를 이용한 체크박스 만들기
# -*- coding: cp949 -*-
#!/usr/bin/python
# checkbox.py
import wx
class MyCheckBox(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(250, 170))
panel = wx.Panel(self, -1)
# 체크박스 생성
self.cb = wx.CheckBox(panel, -1, 'Show Title', (10, 10))
self.cb.SetValue(True)
# 체크박스 이벤트 연결
wx.EVT_CHECKBOX(self, self.cb.GetId(), self.ShowTitle)
self.Show()
self.Centre()
def ShowTitle(self, event):
if self.cb.GetValue():
self.SetTitle('checkbox.py')
else: self.SetTitle('')
app = wx.App(0)
MyCheckBox(None, -1, 'checkbox.py')
app.MainLoop()
[실행 화면]
'Language > Python' 카테고리의 다른 글
[wxPython] wx.frame 의 style 지정 방법 (0) | 2017.02.07 |
---|---|
[Pyinstaller] exe 파일 빌드하며 짜증났던 부분 정리 (0) | 2017.02.06 |
[wxPython] wx.ComboBox(콤보 박스)를 사용법 및 이벤트 처리 (0) | 2017.02.06 |
[wxPython] wx.StaticBox를 이용한 컨트롤 그룹만들기 (0) | 2017.02.06 |
[wxPython] wx.StaticText를 이용한 문자열 출력 (0) | 2017.02.06 |