Answer the question
In order to leave comments, you need to log in
How to fix error when opening compiled python file?
Good day, when you run this code, in the development environment,
from tkinter import *
import tkinter as tk
root = Tk()
image = tk.PhotoImage(file="icon.png")
Button(root, image=image, command=lambda: print('click')).pack()
root.wm_state('zoomed')
root.mainloop()
Answer the question
In order to leave comments, you need to log in
My version of libastral is a bit old, but I'll try: add a line like #!/usr/bin/python (for linux) to the beginning of the file.
Well and than you so to speak 'compile'?
In general, tkinter is hard to compile :)
I advise you to try pyinstaller :) - in theory it's even better than cx_freeze because the 'build' is smaller !
Well, if all the same cx_freeze then I advise you to use this script to 'compile' :
import os
from cx_Freeze import setup, Executable
os.environ['TCL_LIBRARY'] = "C:\\Users\\Ternick\\AppData\\Local\\Programs\\Python\\Python36\\tcl\\tcl8.6"
os.environ['TK_LIBRARY'] = "C:\\Users\\Ternick\\AppData\\Local\\Programs\\Python\\Python36\\tcl\\tk8.6"
buildOptions = dict(
packages = [],
excludes = [],
include_files=['C:\\Users\\Ternick\\AppData\\Local\\Programs\\Python\\Python36\\DLLs\\tcl86t.dll', 'C:\\Users\\Ternick\\AppData\\Local\\Programs\\Python\\Python36\\DLLs\\tk86t.dll']
)
import sys
base = 'Win32GUI' if sys.platform=='win32' else None
executables = [
Executable('1.py', base=base)
]
setup(name='editor',
version = '1.0',
description = '',
options = dict(build_exe = buildOptions),
executables = executables)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question