Skip to content

Commit 1893fbc

Browse files
committed
Icon + build instructions
1 parent b516103 commit 1893fbc

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

VATSIM.ico

31.2 KB
Binary file not shown.

main.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,25 @@
33
import tkinter as tk
44
import customtkinter as ctk
55
import os
6+
import sys
67
import configparser
78
from datetime import datetime, timezone
89

10+
# pyinstaller main.py --onefile --icon=VATSIM.ico --add-data "VATSIM.ico;." -w -n Vatsim-Discord-RPC
11+
12+
'''Used for VATSIM.ico file during compiling'''
13+
def resource_path(relative_path):
14+
try:
15+
# PyInstaller creates a temp folder and stores the path in _MEIPASS
16+
base_path = sys._MEIPASS
17+
except Exception:
18+
base_path = os.path.abspath(".")
19+
20+
return os.path.join(base_path, relative_path)
921

1022
# Path for config.ini
1123
roaming_path = os.path.join(os.getenv('APPDATA'), "VATSIM-Discord-RPC")
24+
1225
# If path does not exist, then creates it
1326
if not os.path.exists(roaming_path):
1427
os.makedirs(roaming_path)
@@ -46,7 +59,6 @@ def get_pilot_info(user_cid):
4659
def get_data(user_cid):
4760
try:
4861
pilot = get_pilot_info(user_cid)
49-
print(pilot)
5062
call_sign = pilot.get("callsign")
5163
altitude = pilot.get("altitude")
5264
hdg = pilot.get("heading")
@@ -99,6 +111,7 @@ def get_data(user_cid):
99111
root = ctk.CTk()
100112
root.title("VATSIM Discord Rich Presence")
101113
root.geometry("450x200")
114+
root.wm_iconbitmap(resource_path("VATSIM.ico"))
102115

103116
# cid and checkbox values
104117
cid_var = tk.StringVar()
@@ -176,7 +189,7 @@ def update_presence():
176189
# Makes sure pilot is online and exists
177190
if(data!= None):
178191
formated_string = ""
179-
192+
180193
# Sets depature airport
181194
if data[1]:
182195
formated_string += f"{data[1]}"

0 commit comments

Comments
 (0)