打发无聊时间,能让人快速“平复”心情,使人“心情愉悦”
# -*- coding:utf-8 -*-
import wx
from random import randint
import win32api
class Frame(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, title='你追我,如果你追到我......', size=(width, height),name='frame',style=541067264)
self.qdck = wx.Panel(self)
self.Centre()
self.qdck.Bind(wx.EVT_ENTER_WINDOW,self.qdck_in)
def qdck_in(self,event):
global x, y
move_x = randint(0, x)
move_y = randint(0, y)
self.MoveXY(move_x, move_y)
self.SetTitle('嘿 嘿 嘿')
class myApp(wx.App):
def OnInit(self):
self.frame = Frame()
self.frame.Show(True)
return True
width = 250
height = 100
x = win32api.GetSystemMetrics(0) - width
y = win32api.GetSystemMetrics(1) - height
if __name__ == '__main__':
app = myApp()
app.MainLoop()
|