2020camera = 1 # à Modifier si ne fonctionne pas
2121
2222#add id to app to show icon in window and taskbar
23- myappid = 'bit-scripts.matrix.cameraascii.twelve' # arbitrary string
24- ctypes .windll .shell32 .SetCurrentProcessExplicitAppUserModelID (myappid )
23+ # myappid = 'bit-scripts.matrix.cameraascii.twelve' # arbitrary string
24+ # ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID(myappid)
2525
2626# Variable partagée pour signaler à un thread qu'il doit s'arrêter
2727stop = threading .Event ()
@@ -44,6 +44,17 @@ def image_to_ascii(image):
4444 ascii_image += "\n "
4545 return ascii_image
4646
47+
48+ def resource_path (relative_path ):
49+ """ Get absolute path to resource, works for dev and for PyInstaller """
50+ try :
51+ # PyInstaller creates a temp folder and stores path in _MEIPASS
52+ base_path = sys ._MEIPASS
53+ except Exception :
54+ base_path = os .path .abspath ("." )
55+
56+ return os .path .join (base_path , relative_path )
57+
4758# Création de la fenêtre tkinter
4859root = tk .Tk ()
4960root .configure (bg = '#000' )
@@ -53,7 +64,8 @@ def image_to_ascii(image):
5364sh = root .winfo_screenheight ()
5465root .geometry ("%dx%d+%d+%d" % (1100 , 620 , (sw - 1100 )/ 2 , (sh - 620 )/ 2 ))
5566directory = os .getcwd ()
56- root .tk .call ('wm' ,'iconphoto' ,root ._w ,tk .PhotoImage (file = directory + "/icon-32.png" ))
67+ #root.tk.call('wm','iconphoto',root._w,tk.PhotoImage(file=directory + "/icon-32.png"))
68+ root .iconbitmap (resource_path ('matrix.ico' ))
5769root .title ("ASCII Camera" )
5870if getattr (sys , 'frozen' , False ):
5971 import pyi_splash
0 commit comments