Skip to content

Commit abe259c

Browse files
committed
setup icon
1 parent 450fb02 commit abe259c

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

assets/icon.png

25.9 KB
Loading

main.py

+16-7
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
import serial
1515
import glob
1616
import sys
17+
import os
1718

1819

1920
logging.basicConfig(level=logging.INFO)
20-
customtkinter.set_appearance_mode("System")
21+
customtkinter.set_appearance_mode('System')
2122
style.use('ggplot')
2223

2324
config = ConfigParser()
@@ -292,14 +293,23 @@ def serial_ports():
292293
return result
293294

294295

296+
def get_icon():
297+
current_path = os.getcwd()
298+
if sys.platform == 'linux':
299+
path_n_file = current_path + "/assets/icon.png"
300+
elif os.name == 'win':
301+
path_n_file = current_path + "\\assets\\icon.png"
302+
else:
303+
raise Exception("Unknown system")
304+
print(path_n_file)
305+
return path_n_file
306+
307+
295308
def main():
296309
loop = asyncio.new_event_loop()
297310
asyncio.set_event_loop(loop)
298-
299-
customtkinter.set_appearance_mode("System")
300-
customtkinter.set_default_color_theme("blue")
301-
302-
Window(loop)
311+
app = Window(loop)
312+
app.wm_iconphoto(True, tk.PhotoImage(file=get_icon()))
303313
loop.run_forever()
304314
loop.close()
305315

@@ -310,4 +320,3 @@ def main():
310320

311321

312322

313-

0 commit comments

Comments
 (0)