[wxPython] 이벤트03 (사이즈 이벤트 예제 : wx.EVT_SIZE)

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

import wx


class MoveEvent(wx.Frame):
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self, parent, id, title)
        # 좌표값 출력 라벨 구성
        wx.StaticText(self, -1, 'x:', (10,0))
        wx.StaticText(self, -1, 'y:', (10,20))
        self.st1 = wx.StaticText(self, -1, '', (30, 0))
        self.st2 = wx.StaticText(self, -1, '', (30, 20))
       
        # 이동 이벤트 연결
        self.Bind(wx.EVT_MOVE, self.OnMove)
        self.Centre()

    # 이동 이벤트 처리 함수
    def OnMove(self, event):
        # 이벤트 발생시 현재 윈도우의 위치값을 구함.
        x, y = event.GetPosition()
        # 좌표값 셋팅
        self.st1.SetLabel(str(x))
        self.st2.SetLabel(str(y))

class MyApp(wx.App):
    def OnInit(self):
        me = MoveEvent(None, -1, 'moveevent.py')
        me.Show(True)
        return True

app = MyApp(0)
app.MainLoop()

[실행 화면]


















by 하린아빠 | 2008/02/26 18:52 | wxPython | 트랙백 | 덧글(0)
트랙백 주소 : http://pythondev.egloos.com/tb/104036
☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]

:         :

:

비공개 덧글



< 이전페이지 다음페이지 >