-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpython_test.py
More file actions
45 lines (32 loc) · 1.4 KB
/
Copy pathpython_test.py
File metadata and controls
45 lines (32 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import subprocess
from python_tkinterMini.tkinterMini import SimpleGUI
import tkinter as tk
import tkinter.font as tkFont
from PIL import Image, ImageTk
n = 0
# create the app instance
app = SimpleGUI(title="Tkinter Example", width=1000, height=500)
custom_font = tkFont.Font(family="Comic Sans", size=20, weight="bold", slant="italic")
# Set background color
# Load and display the image
image_path = '/Users/ajalagao/Desktop/Libcomp/Libcomp_sum_2024/blurry-beach-background.jpg' # Replace with the path to your image
image = Image.open(image_path)
photo = ImageTk.PhotoImage(image)
window_width, window_height = 1000, 500
image = image.resize((window_width, window_height))
photo = ImageTk.PhotoImage(image)
image_label = tk.Label(app.root, image=photo)
image_label.image = photo # Keep a reference to avoid garbage collection
image_label.place(relx=0.5, rely=0.5, anchor='center')
app.root.configure(bg='lightblue')
label1 = app.add_label("I am a Funny Guy", row=0, column=0)
label1.config(fg='red', bg='lightblue', font=custom_font)
label = app.add_label("", row=0, column=10)
label.place(relx=0.5, rely=0.5, anchor='center')
label.config(fg='black', bg='white', font=custom_font)
def on_button_click():
global n
result = subprocess.run(['./jokeWriter'], text=True, capture_output=True)
label.config(text=result.stdout)
app.add_button("Jokes", command=on_button_click, row=1, column=0)
app.run()