V
V
vadimeasy2021-10-31 10:08:37
Python
vadimeasy, 2021-10-31 10:08:37

Why doesn't Tkinker interface work after compiling to EXE?

Hello, please tell me why the interface may not work in an EXE file. Converted with help pyinstaller, if I run from VS Code, everything works.
Here is the interface code:

import os
import time
import pyautogui as pag 
import time
import os 
import shutil
from os import path
from shutil import copyfile
import glob
import zipfile

def setup():
    if settings_utm_value.get()==('Yes'):
        os.startfile('Start.exe', 'runas')

    if setup_vpn_value.get()==('Yes'):
        set_vpn


def set_vpn():
    # files_to_copy = glob.glob(r'C:/Users/kolom/Desktop/Main programm/Auto_EGAIS/openvpn-install.zip')
    # destination_path = (r'C:/Program Files/test')
    # for file in files_to_copy:
    #     shutil.copy2(file, destination_path)


    directory_file = (r"C:/Users/kolom/Desktop/Main programm/Auto_EGAIS/OpenVPN.zip")
    fantasy_zip = zipfile.ZipFile(directory_file)
    fantasy_zip.extractall(r'C:/Program Files/test')
    fantasy_zip.close()


import tkinter as tk 
from tkinter import * 
win = tk.Tk()
frame = Frame()
photo = tk.PhotoImage(file='ico.ico')
win.iconphoto(False, photo)
win.config(bg='#CCC')
win.title('UTM Настройка')
win.geometry("500x300+590+240")


label_1 = tk.Label(win, text='Выбери, что будем устанавливать.', bg='#CCC', font=('Arial',14))
label_1.pack()

settings_utm_value = tk.StringVar()
settings_utm_value.set('Yes')
settings_utm = tk.Checkbutton(text="Настроить связь с сервером",bg='#CCC', font=('Arial',12), variable=settings_utm_value, onvalue='Yes', offvalue='No')

settings_utm.pack(anchor=W, padx=20)

setup_utm = tk.Checkbutton(text="Установить УТМ",bg='#CCC', font=('Arial',12))
setup_utm.pack(anchor=W, padx=20)

setup_vpn_value = tk.StringVar()
setup_vpn_value.set('Yes')
setup_vpn = tk.Checkbutton(text="Установить Open VPN",bg='#CCC', font=('Arial',12), variable=setup_vpn_value, onvalue='Yes', offvalue='No')
setup_vpn.pack(anchor=W, padx=20)

btn = tk.Button(win, text='Установить', command=setup)
btn.pack()

win.resizable(False, False)

Has anyone come across this, please help me figure it out.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question