- 论坛徽章:
- 0
|
#-*- encoding:UTF-8 -*-
import wx
import time
class Frame(wx.Frame):
def __init__(self, image, parent=None, id=-1,
pos=wx.DefaultPosition, title='Hello, wxPython!'):
temp = image.ConvertToBitmap()
size = temp.GetWidth(), temp.GetHeight()
wx.Frame.__init__(self, parent, id, title, pos, size)
panel = wx.Panel(self)
self.bmp = wx.StaticBitmap(parent=panel, bitmap=temp)
self.SetClientSize(size)
class App(wx.App):
def OnInit(self):
self.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER,App,self.timer)
self.timer.Start(1000,oneShot=False)
image = wx.Image('.\pythondemo\multiline.png', wx.BITMAP_TYPE_PNG)
self.frame = Frame(image)
self.frame.Show()
self.SetTopWindow(self.frame)
return True
def main():
app = App()
app.MainLoop()
if __name__ == '__main__':
main() |
已经添加了wx.timer,但现在出现的问题,是每秒钟重新打开一个窗口显示图片,窗口越来越多,能否就只显示在同一个窗口内呢? |
|