diff -ur v7/wx_ut.py v8/wx_ut.py --- v7/wx_ut.py Thu Oct 1 20:03:50 2020 +++ v8/wx_ut.py Mon May 2 19:11:52 2022 @@ -1,5 +1,6 @@ #!/usr/bin/env python +import os import wx import empty @@ -333,18 +334,35 @@ e.app = self e.frame = wx_new( wx.Frame, title, parent=None ) bind( e.frame, quit_hdl, wx.EVT_CLOSE ) + set_icon() init( e ) e.frame.Layout() e.frame.Fit() + e.frame.FitInside() e.app.SetTopWindow( e.frame ) + ( w, h ) = e.frame.GetSize() + e.frame.SetMinSize( ( w, h + 10 ) ) # title bar height ? + if e.on_init: e.on_init( e ) else: e.frame.Show() return 1 + + def set_icon( path='hoge.png' ): + if not e.frame: + return + + if not os.path.exists( path ): + return + + bm = wx.Bitmap( path ) + icon = wx.EmptyIcon() + icon.CopyFromBitmap( bm ) + e.frame.SetIcon( icon ) def poll_start(poll_func, sec, hz, gc): th = None