if dlg.ShowModal() == wx.ID_OK:
path = dlg.GetPath()
if os.path.splitext(path)[1].lower() == ".png":
imgType = wx.BITMAP_TYPE_PNG
else:
imgType = wx.BITMAP_TYPE_JPEG
self.bitmap.GetBitmap().SaveFile(path, imgType)
def OnClipBoard(self, evt):
"""复制二维码到剪切板事件处理"""
if len(self.tc.GetValue()) > 0:
if wx.TheClipboard.Open():
wx.TheClipboard.SetData(wx.BitmapDataObject(self.bitmap.GetBitmap()))
wx.TheClipboard.Close()