-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGUI_version.py
More file actions
61 lines (51 loc) · 1.32 KB
/
GUI_version.py
File metadata and controls
61 lines (51 loc) · 1.32 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import random
import tkinter as tk
subjects = [
"Ronaldo",
"Priyanka Chopra",
"Street Dog",
"Little Boy",
"Wild Lemur",
"Old Woman",
"Greedy Dolphin"
]
actions = [
"dances",
"celebrates",
"cries",
"sleeps",
"asks for a beer",
"makes bed",
"takes a bath"
]
placesOrObjects = [
"at Burj Khalifa",
"inside a cave",
"during FIFA",
"on a Tree",
"in the sea",
"at Mumbai Airport",
"in a rundown hut"
]
def generate_headline():
subject = random.choice(subjects)
action = random.choice(actions)
place = random.choice(placesOrObjects)
headline = f"BREAKING NEWS:\n{subject} {action} {place}"
headline_label.config(text=headline)
# Create window
window = tk.Tk()
window.title("Fake News Headline Generator")
window.geometry("500x300")
# Heading
title_label = tk.Label(window, text="Fake News Headline Generator", font=("Arial", 16, "bold"))
title_label.pack(pady=10)
# Headline display
headline_label = tk.Label(window, text="", font=("Arial", 12), wraplength=450, justify="center")
headline_label.pack(pady=20)
# Buttons
generate_button = tk.Button(window, text="Generate Headline", command=generate_headline)
generate_button.pack(pady=5)
exit_button = tk.Button(window, text="Exit", command=window.destroy)
exit_button.pack(pady=5)
window.mainloop()