test.py(它只是显示一个滚动条)
from Tkinter import *
import ttk
class ScrollTest(object):
def __init__(self, master):
self.canvas = Canvas(master, bd=0, highlightthickness=0)
self.mainframe = ttk.Frame(self.canvas)
self.scrollbar = Scrollbar(master, orient="vertical", command=self.canvas.yview)
self.canvas.configure(yscrollcommand=self.scrollbar.set)
self.scrollbar.pack(side=RIGHT, fill=Y)
self.canvas.pack(side=TOP, fill=BOTH, expand=1)
self.canvas.create_window((640, 0), window=self.mainframe, anchor=N, tags="self.mainframe")
self.mainframe.bind("<Configure>", self.configure)
self.canvas.bind_all("<MouseWheel>", self.scroll)
def configure(self, e):
self.canvas.configure(scrollregion=self.canvas.bbox("all"))
def scroll(self, e):
if self.mainframe.winfo_height() > 720:
self.canvas.yview_scroll(-1*(e.delta/30), 'units')
root = Tk()
app = ScrollTest(root)
root.mainloop()
使用PyInstaller 3.0
时,我运行
python pyinstaller.py test.py
一切都按预期工作,滚动条完全按预期显示(即看起来像Windows XP滚动条)。
然而,当我跑
时python pyinstaller.py --noconsole test.py
滚动条有一个Windows 10主题(我正在运行Windows 10)。为什么会发生这种情况?如何在不使用XP
或--noconsole
主题时使用10
主题?