PROBLEM SOLVED. the issue was with jaraco module, that i used for clipboard manipulation, i used pyperclip instead.
I made a python app with tkinter that works fine, but I wanted to make an exe from it so it's user friendly in windows. I used cx_Freeze library for that, that works fine too, but not always.
When creating the exe using cx_Freeze you can specify base parameter, if you give none that will open 2 windows, cmd window and a GUI window for your app. To get rid of the cmd window you can specify "Win32GUI" as base parameter for cx_Freeze.
This ignores the cmd window and just opens the GUI, it seems to be working, but not always. Sometimes opening the exe file will start the proccess but no GUI will show. Opening cmd and going to the directory of your exe and starting it from there will actually show the GUI and fix the problem untill you restart your pc (you can open the app without cmd with everything working untill restart)
It seems that as long as cmd window is in your ram, the GUI will show, otherwise it "doesn't know" and fails to show GUI.
The code can be found here: https://github.com/GrishaDev/ClipMagic
clip.py is the entire app
setup.pyis the file used with cx_Freeze to get exe of the app, that's where you specify base parameter and such.
the piece of code where the problem most likely is (setup.py
):
import sys
from cx_Freeze import setup, Executable
# import os
# os.environ['TCL_LIBRARY'] = "C:\\Users\\Grisha\\AppData\\Local\\Programs\\Python\\Python35\\tcl\\tcl8.6"
# os.environ['TK_LIBRARY'] = "C:\\Users\\Grisha\\AppData\\Local\\Programs\\Python\\Python35\\tcl\\tk8.6"
import os.path
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6')base = None
if sys.platform == "win32":base = "Win32GUI"setup(name="clipmagic",version="1",description="Extended clipboard",options={'build_exe': {'includes': ["jaraco", "tkinter"], 'include_files':[os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tk86t.dll'),os.path.join(PYTHON_INSTALL_DIR, 'DLLs', 'tcl86t.dll'),'icon.ico',]}},executables=[Executable("clip.py", base=base, icon='icon.ico')])#"Win32GUI"
Thanks!