[참고]
import tkinter as tk
from tkinter import ttk
#create instance
win = tk.Tk()
#add a title
win.title("Python GUI")
tabControl = ttk.Notebook(win) #create tab control
tab1 = ttk.Frame(tabControl) #create a tab
tabControl.add(tab1, text = 'Tab 1') #add the tab
tab2 = ttk.Frame(tabControl) #add a second tab
tabControl.add(tab2, text = 'Tab 2') #make second tab visible
tabControl.pack(expand = 1, fill = "both") #pack to make visible
#LabelFrame using tab1 as the parent
mighty = ttk.LabelFrame(tab1, text = 'Mighty Python')
mighty.grid(column = 0, row = 0, padx = 8, pady = 4)
#Label using mighty as the parent
a_label = ttk.Label(mighty, text = "Enter a name:")
a_label.grid(column = 0, row = 0, stick = 'W')
#start GUI
win.mainloop()
[결과]
'#Python GUI Programming Cookbook' 카테고리의 다른 글
#파이썬GUI #tkinter #창 사이즈 설정 (0) | 2020.07.30 |
---|---|
#tkinter #GUI폼 만들기 #위젯 추가 (0) | 2019.04.10 |
#Tab 2개 만들기 (0) | 2018.12.21 |
#Tab 만들기 (0) | 2018.12.21 |
#tkinter #체크 버튼 #라디오 버튼 만들기 (0) | 2018.12.17 |