728x90
import tkinter.ttk as ttk
from tkinter import *
root =Tk()
root.title(" GUI")
root.geometry("640x480")
def create_new_file():
print("새 파일을 만듭니다.")
menu = Menu(root)
# File 메뉴
menu_file = Menu(menu, tearoff = 0 )
menu_file.add_command(label ="New File", command = create_new_file)
menu_file.add_separator()
menu_file.add_command(label ="Open File ...")
menu_file.add_separator()
menu_file.add_command (label ="Save All", state = "disable" ) # 비활성화
menu_file.add_separator()
menu_file.add_command (label ="Exit", command = root.quit )
menu.add_cascade(label ="File", menu =menu_file)
# File 메뉴
menu.add_cascade(label ="Edit", menu =menu_file)
# Language 메뉴 추가 (radio 버튼을 통해서 택1)
menu_lang = Menu(menu, tearoff =0)
menu_lang.add_radiobutton(label ="Python")
menu_lang.add_radiobutton(label ="Java")
menu_lang.add_radiobutton(label ="C++")
menu.add_cascade(label = "Language", menu = menu_lang)
# View 메뉴
menu_view = Menu(menu, tearoff = 0)
menu_view.add_checkbutton(label = "Show Minimap")
menu.add_cascade(label = "View", menu = menu_view)
root.config(menu = menu)
root.mainloop()
728x90
'개발자 모드 > 파이썬(python)' 카테고리의 다른 글
파이썬 시간 모듈 사용법 (0) | 2021.06.25 |
---|---|
파이썬(python) GPS GPRMC 체크섬(checksum) 구하는 코드 (0) | 2021.06.24 |
파이썬 python 프로그레스 바(progressbar) 기초 예제 (0) | 2021.06.23 |
파이썬 python 콤보박스 combobox 기초예제 (0) | 2021.06.19 |
파이썬 python 라디오박스 radiobox 기초예제 (0) | 2021.06.18 |