As a school project, we are making a marketing survey like the Ideal World Cup.
This is my first semester, so I'm a total beginner, and I've built an ideal World Cup,
It's tkinter. It's a bit sloppy in the idle, but it works.
But you have to make it available to people like Google Forms and Naver Forms
I don't know what to do ㅜ<
Help me!
python idle
Can you show me the World Cup you made with the IDLE? It's a little too much because it doesn't come out no matter how much I turn it
So far, that's it!
import random
import tkinter as tk
from tkinter import messagebox
import tkinter.filedialog as tk
import matplotlib.pyplot as plt
import numpy as np
import matplotlib.font_manager as fm
def childWindow1():
window = tk.Toplevel()
window.title("food")
def delet() :
if len(lists) > 1 :
ran1 = random.choice(lists)
button2.configure(image=ran1)
messagebox.showinfo ("Your Choice", "Out")
lists.remove(ran1)
print(len(lists))
else :
button2.configure(image=photo9, command=end)
messagebox.showinfo ("Your choice", "Your final choice".")
print(len(lists))
def delet2() :
if len(lists) > 1 :
ran1 = random.choice(lists)
button1.configure(image=ran1)
messagebox.showinfo ("Your Choice", "Out")
lists.remove(ran1)
print(len(lists))
else :
button1.configure(image=photo9, command=end)
messagebox.showinfo ("Your choice", "Your final choice".")
print(len(lists))
img1 = 'data/food/chi.PNG'
img2 = 'data/food/dduck.PNG'
img3 = 'data/food/jok.PNG'
img4 = 'data/food/pizza.PNG'
img5 = 'data/food/ramen.PNG'
img6 = 'data/food/sushi.png'
img7 = 'data/food/sam.png'
img8 = 'data/food/h.PNG'
img9 = 'data/end.png'
photo1 = tk.PhotoImage(file=img1)
photo2 = tk.PhotoImage(file=img2)
photo3 = tk.PhotoImage(file=img3)
photo4 = tk.PhotoImage(file=img4)
photo5 = tk.PhotoImage(file=img5)
photo6 = tk.PhotoImage(file=img6)
photo7 = tk.PhotoImage(file=img7)
photo8 = tk.PhotoImage(file=img8)
photo9 = tk.PhotoImage(file=img9)
lists = [photo3, photo4, photo5, photo6, photo7, photo8]
button1 = tk.Button(window, image=photo1, command=delet)
label1 = tk.Label (window,text='Click your favorite photo')
button2 = tk.Button(window, image=photo2, command=delet2)
label2 = tk.Label (window,text='Click your favorite photo')
button1.grid(row=0,column=0)
button2.grid(row=0,column=1)
label1.grid(row=1,column=0)
label2.grid(row=1,column=1)
window.mainloop()
def childWindow2():
window = tk.Toplevel()
window.title ("celebrity")
def delet() :
if len(lists) > 1 :
ran1 = random.choice(lists)
button2.configure(image=ran1)
messagebox.showinfo ("Your Choice", "Out")
lists.remove(ran1)
print(len(lists))
else :
button2.configure(image=photo9, command=end)
messagebox.showinfo ("Your choice", "Your final choice".")
print(len(lists))
def delet2() :
if len(lists) > 1 :
ran1 = random.choice(lists)
button1.configure(image=ran1)
messagebox.showinfo ("Your Choice", "Out")
lists.remove(ran1)
print(len(lists))
else :
button1.configure(image=photo9, command=end)
messagebox.showinfo ("Your choice", "Your final choice".")
print(len(lists))
img1 = 'data/ri.png'
img2 = 'data/da.png'
img3 = 'data/iu.png'
img4 = 'data/kim.png'
img5 = 'data/hong.png'
img6 = 'data/su.png'
img7 = 'data/ye.png'
img8 = 'data/shin.png'
img9 = 'data/end.png'
photo1 = tk.PhotoImage(file=img1)
photo2 = tk.PhotoImage(file=img2)
photo3 = tk.PhotoImage(file=img3)
photo4 = tk.PhotoImage(file=img4)
photo5 = tk.PhotoImage(file=img5)
photo6 = tk.PhotoImage(file=img6)
photo7 = tk.PhotoImage(file=img7)
photo8 = tk.PhotoImage(file=img8)
photo9 = tk.PhotoImage(file=img9)
lists = [photo3, photo4, photo5, photo6, photo7, photo8]
button1 = tk.Button(window, image=photo1, command=delet)
label1 = tk.Label (window,text='Click your favorite photo')
button2 = tk.Button(window, image=photo2, command=delet2)
label2 = tk.Label (window,text='Click your favorite photo')
button1.grid(row=0,column=0)
button2.grid(row=0,column=1)
label1.grid(row=1,column=0)
label2.grid(row=1,column=1)
window.mainloop()
def childWindow3():
window = tk.Toplevel()
window.title ("game")
def delet() :
if len(lists) > 1 :
ran1 = random.choice(lists)
button2.configure(image=ran1)
messagebox.showinfo ("Your Choice", "Out")
lists.remove(ran1)
print(len(lists))
else :
button2.configure(image=photo9, command=end)
messagebox.showinfo ("Your choice", "Your final choice".")
print(len(lists))
def delet2() :
if len(lists) > 1 :
ran1 = random.choice(lists)
button1.configure(image=ran1)
messagebox.showinfo ("Your Choice", "Out")
lists.remove(ran1)
print(len(lists))
else :
button1.configure(image=photo9, command=end)
messagebox.showinfo ("Your choice", "Your final choice".")
print(len(lists))
img1 = 'data/game/battle.png'
img2 = 'data/game/fifa.png'
img3 = 'data/game/over.png'
img4 = 'data/game/star.png'
img5 = 'data/game/sudden.png'
img6 = 'data/game/lol.png'
img7 = 'data/game/lost.png'
img8 = 'data/game/map.png'
img9 = 'data/end.png'
photo1 = tk.PhotoImage(file=img1)
photo2 = tk.PhotoImage(file=img2)
photo3 = tk.PhotoImage(file=img3)
photo4 = tk.PhotoImage(file=img4)
photo5 = tk.PhotoImage(file=img5)
photo6 = tk.PhotoImage(file=img6)
photo7 = tk.PhotoImage(file=img7)
photo8 = tk.PhotoImage(file=img8)
photo9 = tk.PhotoImage(file=img9)
lists = [photo3, photo4, photo5, photo6, photo7, photo8]
button1 = tk.Button(window, image=photo1, command=delet)
label1 = tk.Label (window,text='Click your favorite photo')
button2 = tk.Button(window, image=photo2, command=delet2)
label2 = tk.Label (window,text='Click your favorite photo')
button1.grid(row=0,column=0)
button2.grid(row=0,column=1)
label1.grid(row=1,column=0)
label2.grid(row=1,column=1)
window.mainloop()
def childWindow4():
window = tk.Toplevel()
window.title ("celebrity")
def delet() :
if len(lists) > 1 :
ran1 = random.choice(lists)
button2.configure(image=ran1)
messagebox.showinfo ("Your Choice", "Out")
lists.remove(ran1)
print(len(lists))
else :
button2.configure(image=photo9, command=end)
messagebox.showinfo ("Your choice", "Your final choice".")
print(len(lists))
def delet2() :
if len(lists) > 1 :
ran1 = random.choice(lists)
button1.configure(image=ran1)
messagebox.showinfo ("Your Choice", "Out")
lists.remove(ran1)
print(len(lists))
else :
button1.configure(image=photo9, command=end)
messagebox.showinfo ("Your choice", "Your final choice".")
print(len(lists))
city.append(lists[0])
print(city)
city = []
img1 = 'data/city/istanbul.PNG'
img2 = 'data/city/hongkong.PNG'
img3 = 'data/city/amsterdam.PNG'
img4 = 'data/city/london.PNG'
img5 = 'data/city/dubai.PNG'
img6 = 'data/city/tokyo.PNG'
img7 = 'data/city/paris.PNG'
img8 = 'data/city/newyork.PNG'
img9 = 'data/end.PNG'
photo1 = tk.PhotoImage(file=img1)
photo2 = tk.PhotoImage(file=img2)
photo3 = tk.PhotoImage(file=img3)
photo4 = tk.PhotoImage(file=img4)
photo5 = tk.PhotoImage(file=img5)
photo6 = tk.PhotoImage(file=img6)
photo7 = tk.PhotoImage(file=img7)
photo8 = tk.PhotoImage(file=img8)
photo9 = tk.PhotoImage(file=img9)
lists = [photo3, photo4, photo5, photo6, photo7, photo8]
button1 = tk.Button(window, image=photo1, command=delet)
label1 = tk.Label (window,text='Click your favorite photo')
button2 = tk.Button(window, image=photo2, command=delet2)
label2 = tk.Label (window,text='Click your favorite photo')
button1.grid(row=0,column=0)
button2.grid(row=0,column=1)
label1.grid(row=1,column=0)
label2.grid(row=1,column=1)
window.mainloop()
root = tk.Tk()
img01 = 'data/food/food.png'
img02 = 'data/tae.png'
img03 = 'data/game/game.png' img04 = 'data/city/trip.PNG'
photo01 = tk.PhotoImage(file = img01, width=400, height=400)
photo02 = tk.PhotoImage(file = img02, width=400, height=400)
photo03 = tk.PhotoImage(file = img03, width=400, height=400)
photo04 = tk.PhotoImage(file = img04, width=400, height=400)
button01 = tk.Button(root, image=photo01, command=childWindow1)
button02 = tk.Button(root, image=photo02, command=childWindow2)
button03 = tk.Button(root, image=photo03, command=childWindow3)
button04 = tk.Button(root, image=photo04, command=childWindow4)
label01 = tk.Label (root, text = 'food')
label02 = tk.Label (root, text = 'celebrity')
label03 = tk.Label (root, text = 'game')
label04 = tk.Label (root, text = 'travel destination')
button01.grid(row=0,column=0)
button02.grid(row=0,column=1)
button03.grid(row=2,column=0)
button04.grid(row=2,column=1)
label01.grid(row=1,column=0)
label02.grid(row=1,column=1)
label03.grid(row=3,column=0)
label04.grid(row=3,column=1)
messagebox.showinfo ("Please select a choice", "After making a choice, minimize the choice window"),
root.mainloop()
© 2024 OneMinuteCode. All rights reserved.