- Joined
- May 12, 2017
- Posts
- 3,845
- Solutions
- 8
- Reaction
- 7,363
- Points
- 1,721
Python:
import tkinter as tk
from Test_GUI import *
from PIL import ImageTk, Image
main = tk.Tk()
main.attributes('-fullscreen', False)
main.geometry('1080x200')
main.maxsize(1080, 200)
main.title('Price Checker Comandline')
# Load the background image using PIL
image = Image.open("/Users/Administrator/Documents/VsCode Project/Rebuiding News Price Checker/bg-background.png")
bg_image = ImageTk.PhotoImage(image)
# Create a Canvas widget and add the image to it
canvas = tk.Canvas(main, width=1092, height=200)
canvas.pack(fill="both", expand=True)
canvas.create_image(0, 0, anchor="nw", image=bg_image)
# Load the GIF image
gif_image = Image.open("/Users/Administrator/Documents/VsCode Project/Rebuiding News Price Checker/banner.gif")
gif_frames = []
try:
while True:
gif_frames.append(ImageTk.PhotoImage(gif_image))
gif_image.seek(len(gif_frames))
except EOFError: # End of frames
pass
# Add the first frame of the GIF animation to the canvas
canvas.create_image(550, 50, image=gif_frames[0])
# Define a function to update the canvas with the next frame of the GIF animation
def update_canvas(i):
canvas.itemconfig(canvas_img, image=gif_frames[i])
main.after(50, update_canvas, (i+1) % len(gif_frames))
# Start the animation by calling the update_canvas function
canvas_img = canvas.create_image(550, 50, image=gif_frames[0])
main.after(0, update_canvas, 0)
# Define a function to be called when the button is clicked
def button_click():
print("Sychronizer")
button_font = ("Origin Tech Demo", 20, "bold")
button = tk.Button(main, text="SYNCHRONIZER", command=button_click, font=button_font)
button.place(relx=0.35, rely=0.50, anchor='ne')
button.config(padx=5, pady=5)
# Define a function to be called when the button is clicked
def button_click():
print("Updater")
button_font = ("Origin Tech Demo", 20, "bold") # Change the font, size and style as desired
button = tk.Button(main, text="UPDATER", command=button_click, font=button_font)
button.place(relx=0.60, rely=0.50, anchor='ne')
button.config(padx=30, pady=5)
# Define a function to be called when the button is clicked
def button_click():
print("Price Checker")
button_font = ("Origin Tech Demo", 20, "bold") # Change the font, size and style as desired
button = tk.Button(main, text="PRICE CHECKER", command=button_click, font=button_font)
button.place(relx=0.90, rely=0.50, anchor='ne')
button.config(padx=5, pady=5)
main.mainloop()
mga sir paturo pano po di mag automatic yung na import kong Test_GUI.py dapat sa button po yan ilalagay eh salamat po mga master!