我正在尝试用py2exe创建一个exe.该程序使用Tkinter显示一个类似弹出窗口.问题是,当我像这样运行设置时一切正常:
setup(windows = [{'script': "msg.py"}], zipfile = None)
但是当我尝试制作一个单文件时它失败了:
setup(windows = [{'script': "msg.py"}], zipfile = None, options = {'py2exe': {'bundle_files': 1, 'compressed': True}})
实际上最终的exe运行没有问题,但它没有显示任何窗口.我已经读过在Windows 7上可能存在bundle_files = 1的问题,但我也尝试了bundle_files = 2具有相同的效果.这是我的msg.py脚本:
from win32gui import FindWindow, SetForegroundWindow
from Image import open as iopen
from ImageTk import PhotoImage
from Tkinter import Tk, Label
from threading import Timer
from subprocess import Popen
import os
def Thread(t, fun, arg=None):
    if arg<>None: x = Timer(t, fun, arg)
    else: x = Timer(t, fun)
    x.daemon = True
    x.start()
def …