Make the logo transparent in Python tkinter 3.4 -
this question has answer here:
- removing tk icon on tkinter window 5 answers
i wanted insert icon in gui. have tried inserting 1 need , want make transparent. can make icon transparent in way? appreciated.
i've voted close question duplicate; in meantime, here working code first answer trying do:
python 2.x:
from __future__ import with_statement import tkinter import tempfile import base64 import zlib icon = zlib.decompress(base64.b64decode('ejxjygaeqgebbidjwzdby' 'sagxsdaoaheqcegbqaioag4sdigacmuj4jrmapgwqgf/ykeafxxqrc=')) _, icon_path = tempfile.mkstemp() open(icon_path, 'wb') icon_file: icon_file.write(icon) tk = tkinter.tk() tk.iconbitmap(default=icon_path) label = tkinter.label(tk, text="window transparent icon.") label.pack() tk.mainloop()
python 3.x:
import tkinter import tempfile import base64 import zlib icon = zlib.decompress(base64.b64decode('ejxjygaeqgebbidjwzdby' 'sagxsdaoaheqcegbqaioag4sdigacmuj4jrmapgwqgf/ykeafxxqrc=')) _, icon_path = tempfile.mkstemp() open(icon_path, 'wb') icon_file: icon_file.write(icon) tk = tkinter.tk() tk.iconbitmap(default=icon_path) label = tkinter.label(tk, text="window transparent icon.") label.pack() tk.mainloop()
Comments
Post a Comment