python - Dynamic text on top of wx.SplashScreen -
i using wxpython create splash screen. works great, want put loading feedback on splashscreen. know how can put dynamic label on top of splashscreen? here code using:
class myframe(wxframe): wx.frame.__init__(self, parent, -1, _("radar"), size=(800, 600), style=wx.default_frame_style) class mysplash(wx.splashscreen): def __init__(self, parent=none): abitmap = wx.image(name=varfiles["radar_splash"]).converttobitmap() splashstyle = wx.splash_centre_on_screen | wx.splash_timeout splashduration = 12000 # ms wx.splashscreen.__init__(self, abitmap, splashstyle, splashduration, parent) self.bind(wx.evt_close, self.closesplash) wx.yield() def closesplash(self, evt): self.hide() global frame frame = myframe(parent=none) app.settopwindow(frame) frame.show(true) evt.skip() class myawesomeapp(wx.app): def oninit(self): mysplash = mysplash() mysplash.show() return true
as splashscreen
window displaying bitmap, need modify provided bitmap, doing layouting yourself.
def _draw_bmp(bmp, txt_lst): dc = wx.memorydc() dc.selectobject(bmp) dc.clear() gc = wx.graphicscontext.create(dc) font = wx.systemsettings.getfont(wx.sys_default_gui_font) gc.setfont(font) i, line in enumerate(txt_lst): dc.drawtext(line, 10, * 20 + 15) dc.selectobject(wx.nullbitmap) # ... abitmap = #... _draw_bmp(abitmap, ['splash', 'screen', 'text'])
the wx.graphicscontext
helpful have antialiased text looking same in underlying os.
Comments
Post a Comment