20
20
camera = 1 # à Modifier si ne fonctionne pas
21
21
22
22
#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)
25
25
26
26
# Variable partagée pour signaler à un thread qu'il doit s'arrêter
27
27
stop = threading .Event ()
@@ -44,6 +44,17 @@ def image_to_ascii(image):
44
44
ascii_image += "\n "
45
45
return ascii_image
46
46
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
+
47
58
# Création de la fenêtre tkinter
48
59
root = tk .Tk ()
49
60
root .configure (bg = '#000' )
@@ -53,7 +64,8 @@ def image_to_ascii(image):
53
64
sh = root .winfo_screenheight ()
54
65
root .geometry ("%dx%d+%d+%d" % (1100 , 620 , (sw - 1100 )/ 2 , (sh - 620 )/ 2 ))
55
66
directory = 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' ))
57
69
root .title ("ASCII Camera" )
58
70
if getattr (sys , 'frozen' , False ):
59
71
import pyi_splash
0 commit comments