-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode10-22.py
More file actions
35 lines (28 loc) · 913 Bytes
/
code10-22.py
File metadata and controls
35 lines (28 loc) · 913 Bytes
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
#code10-22.py
from tkinter import *
from tkinter.filedialog import *
def func_open() :
filename = askopenfilename(parent = window,
filetypes = (("GIF 파일","*.gif"),
("모든 파일","*.*")))
photo = PhotoImage(file = filename)
pLabel.configure(image = photo)
pLabel.image = photo
def func_exit() :
window.quit()
window.destory()
#메인 코드 부분
window = Tk()
window.geometry("400x400")
window.title("영화 감상하기")
photo = PhotoImage()
pLabel = Label(window, image = photo)
pLabel.pack(expand = 1, anchor = CENTER)
mainMenu = Menu(window)
window.config(menu = mainMenu)
fileMenu = Menu(mainMenu)
mainMenu.add_cascade(label = "파일", menu = fileMenu)
fileMenu.add_command(label = "파일 열기", command = func_open)
fileMenu.add_separator()
fileMenu.add_command(label = "프로그램 종료", command = func_exit)
window.mainloop()