Skip to content

Instantly share code, notes, and snippets.

@oiojin831
Last active December 7, 2021 00:06
Show Gist options
  • Save oiojin831/97c6e84e094bb066cc105ed37ec38fb1 to your computer and use it in GitHub Desktop.
Save oiojin831/97c6e84e094bb066cc105ed37ec38fb1 to your computer and use it in GitHub Desktop.
from tkinter import Tk, Label, Entry, Button
movies = []
window = Tk()
window.title("Movie App")
window.geometry("600x600")
class Movie():
def __init__(self, title, year, director):
self.title = title
self.year = year
self.director = director
def add_movie():
my_movie = Movie(title_entry.get(), year_entry.get(), director_entry.get())
movies.append(my_movie)
def show_movie():
for m in movies:
label = Label(window)
label["text"] = m.title
label.pack()
# create entries
title_entry = Entry(window)
year_entry = Entry(window)
director_entry = Entry(window)
title_entry.pack()
year_entry.pack()
director_entry.pack()
add_movie_button = Button(window, text="확인", command=add_movie)
add_movie_button.pack()
show_movies_button = Button(window, text="영화 리스트", command=show_movie)
show_movies_button.pack()
window.mainloop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment