강의노트 Notebook
강의노트
• 조회수 21
• 댓글 0
• 작성 11개월 전
• 수정 6일 전
위젯 그룹핑
위젯을 묶음으로 하는 방법에는
위젯 | 설명 | 위젯 | 설명 | |
---|---|---|---|---|
tk.Frame | 텍스트 | tk.PanedWindow | ||
ttk.Frame | ttk.LabelFrame | |||
ttk.Notebook |
Frame
import tkinter as tk
win = tk.Tk()
win.title('Frame 예제')
win.geometry('250x150')
l_win = tk.Label(win,text='Win의 레이블') #1
l_win.pack()
f1 = tk.Frame(win,bg='lightblue',borderwidth=3,relief='solid') #2
f1.pack()
l_frame = tk.Label(f1,text='Frame 안의 레이블')
l_frame.pack()
b1 = tk.Button(f1,text='Frame 버튼')
b1.configure(state='disabled')
b1.pack()
b2 = tk.Button(win,text='Win 버튼')
b2.pack()
win.mainloop()
- win창에 붙은 레이블
- Frame은 win창에 붙어 있고 Frame안에
Notebook
from tkinter import *
from tkinter import ttk
root = Tk()
root.title('Notebook test')
root.geometry('300x200')
root.resizable(True, True)
notebook = ttk.Notebook(root, width=300, height=200)
notebook.pack()
frame1 = Frame(root)
notebook.add(frame1,text='탭 1')
l1 = Label(frame1, text='페이지1')
l1.pack()
frame2 = Frame(root)
notebook.add(frame2,text='탭 2')
l2 = Label(frame2, text='페이지2')
l2.pack()
frame3 = Frame(root)
notebook.add(frame3,text='탭 3')
l3 = Label(frame3, text='페이지3')
l3.pack()
root.mainloop()
이전 글
마지막 글입니다.
로그인 하면 댓글을 쓸 수 있습니다.