【发布时间】:2015-05-10 09:26:25
【问题描述】:
例如,我使用 Tkinter 创建了带有简单 GUI 的 welcomeGUI.py 文件,如下所示。
from Tkinter import *
import ttk
class Application():
def __init__(self, master):
frame = Create_widgets(master)
frame.pack()
class Create_widgets(Frame):
def __init__(self, master):
Frame.__init__(self, master)
self.toplabel = Label(master, text="Welcome!", font=('cambria', 20, 'bold'),
fg="white", bg="Midnight Blue")
self.toplabel.pack(fill=X, ipady=100)
statuslabel = Label(master, bg="Midnight Blue")
statuslabel.pack(fill=X)
self.midlabel = Label(master, text="Device ready,connect a flash drive to continue...",
font=('Ubuntu-L', 12), fg= "white", bg="Midnight Blue", anchor="n")
self.midlabel.pack(fill=X, ipady=5)
bottomlabel = Label(master, bg="Gainsboro")
bottomlabel.pack(side=BOTTOM, fill=X)
button1 = ttk.Button(bottomlabel, text="Close")
button1.pack(side=BOTTOM)
#**** Main ****
root = Tk()
root.title("Projector Plus")
root.configure(bg="Midnight Blue")
root.minsize(550, 550)
pro = Application(root)
root.mainloop()
然后我需要创建这个可以安装在 Ubuntu 上的文件(在 Ubuntu 上创建一个可执行文件)。在 Windows 中,使用 .exe 文件(使用 cx-Freeze)很容易做到这一点。我真的不知道Ubuntu的文件系统和shell文件。
请帮助我了解这个问题。我不知道如何进入这个问题。
【问题讨论】:
-
stackoverflow.com/questions/12089254/…此链接可能会有所帮助。
-
你的意思是包含其他库还是只是 Tkinter?
-
你也可以使用 PyInstaller - 它是跨平台的
-
@PadraicCunningham 是的,包括 OpenCV 中的其他库?如何将它们捆绑到一个可执行文件中?
-
将 opencv 作为依赖并不容易,它有自己的依赖。
标签: python linux ubuntu tkinter executable