Skip to content

Commit db3c7c4

Browse files
authored
Update FoodPanddos.py
Now Downloads the Icon PNG in C drive and uses it for the icon display
1 parent 6a71c7e commit db3c7c4

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

FoodPanddos.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import threading
55
import datetime
66
import os
7+
import requests
8+
from PIL import Image, ImageTk
79

810
# This project is licensed under the [Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License (CC BY-NC-ND 4.0)](https://creativecommons.org/licenses/by-nc-nd/4.0/).
911
# UltimaCodes/NotRyaan 2023
@@ -30,6 +32,28 @@
3032
title_frame = tk.Frame(window)
3133
title_frame.pack(pady=10)
3234

35+
# Specify the image file path in the Downloads folder of the C drive
36+
image_filename = "foodpanda.png"
37+
image_path = os.path.join(os.path.expanduser("~"), "Downloads", image_filename)
38+
39+
# Check if the image file already exists
40+
if not os.path.isfile(image_path):
41+
# Download the image from GitHub
42+
image_url = "https://github.com/UltimaCodes/FoodPanddos/raw/7d6ee12c4231244c7c0646a6109740f81a9582ef/foodpanda.png"
43+
response = requests.get(image_url)
44+
image_data = response.content
45+
46+
# Save the image locally in the Downloads folder
47+
with open(image_path, "wb") as image_file:
48+
image_file.write(image_data)
49+
50+
# Open the image and create a Tkinter-compatible photo image
51+
image = Image.open(image_path)
52+
photo = ImageTk.PhotoImage(image)
53+
54+
# Set the photo image as the window icon
55+
window.iconphoto(True, photo)
56+
3357
# Creating a title label
3458
title_label = tk.Label(title_frame, text="FoodPanddos", font=("Arial", 16, "bold"))
3559
title_label.pack()

0 commit comments

Comments
 (0)