|
4 | 4 | import threading
|
5 | 5 | import datetime
|
6 | 6 | import os
|
| 7 | +import requests |
| 8 | +from PIL import Image, ImageTk |
7 | 9 |
|
8 | 10 | # 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/).
|
9 | 11 | # UltimaCodes/NotRyaan 2023
|
|
30 | 32 | title_frame = tk.Frame(window)
|
31 | 33 | title_frame.pack(pady=10)
|
32 | 34 |
|
| 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 | + |
33 | 57 | # Creating a title label
|
34 | 58 | title_label = tk.Label(title_frame, text="FoodPanddos", font=("Arial", 16, "bold"))
|
35 | 59 | title_label.pack()
|
|
0 commit comments