|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
代码在本地的pycharm上是可以正常运行的,但通过 pyinstaller -F -w 转换成EXE后就报错了
然后我用 CMD 运行 提示说
然后我也按照网上说的 在第一行 添加字符转换 可还是不行,到底是那个地方出错了呢? 请教下大家
我付上源代码:
# -*- coding: utf-8 -*-
import wx
from win32con import AW_ACTIVATE, AW_BLEND, AW_CENTER, AW_HIDE, AW_HOR_NEGATIVE, \
AW_HOR_POSITIVE, AW_SLIDE, AW_VER_NEGATIVE, AW_VER_POSITIVE, SPI_GETWORKAREA
import win32api
from ctypes import windll, c_int
class Popup(wx.MiniFrame):
def __init__(self, label, parent=None, title=""):
wx.MiniFrame.__init__(self, parent, -1, title, wx.DefaultPosition, size=(580, 280),
style=wx.DEFAULT_FRAME_STYLE | wx.STAY_ON_TOP)
for monitor in win32api.EnumDisplayMonitors():
monitor_info = win32api.GetMonitorInfo(monitor[0])
if monitor_info['Flags'] == 1:
break
workarea = monitor_info['Work']
pos = (workarea[2] - 580, workarea[3] - 280)
bg = wx.Colour(255, 255, 225)
self.SetBackgroundColour(bg)
self.SetPosition(pos)
text = wx.StaticText(self, -1, label)
text.SetBackgroundColour(bg)
flags = AW_SLIDE | AW_VER_NEGATIVE | AW_ACTIVATE
windll.user32.AnimateWindow(c_int(self.GetHandle()), c_int(800), c_int(flags))
self.Refresh()
self.Bind(wx.EVT_CLOSE, self.RemovePopup)
def RemovePopup(self, evt=None):
flags = AW_BLEND | AW_HIDE
windll.user32.AnimateWindow(c_int(self.GetHandle()), c_int(800), c_int(flags))
self.Destroy()
if __name__ == '__main__':
app = wx.App(False)
f = Popup('测试右下角弹出框\n测试右下角弹出框\n\n')
f.Show()
app.MainLoop() |
|