[참고]
- 공개 소스코드 : https://github.com/PacktPublishing/Python-GUI-Programming-Cookbook-Second-Edition
- 11장 : https://github.com/PacktPublishing/Python-GUI-Programming-Cookbook-Second-Edition/blob/master/Chapter11/Ch11_Code/GUI__init.py
#GUI__init.py
#======================
# imports
#======================
import tkinter as tk
from tkinter import ttk
#======================
# Create instance
#======================
win = tk.Tk()
#======================
# Add a title
#======================
win.title("Python GUI")
#===============================================================================
# Adding a LabelFrame and a Button
#===============================================================================
lFrame = ttk.LabelFrame(win, text="Python GUI Programming Cookbook")
lFrame.grid(column=0, row=0, sticky='WE', padx=10, pady=10)
def clickMe():
from tkinter import messagebox
messagebox.showinfo('Message Box', 'Hi from same Level.')
button = ttk.Button(lFrame, text="Click Me ", command=clickMe)
button.grid(column=1, row=0, sticky=tk.S)
#======================
# Start GUI
#======================
win.mainloop()
[결과]
'#Python GUI Programming Cookbook' 카테고리의 다른 글
#Tab 안에 LabelFrame과 Label 넣기 (0) | 2018.12.21 |
---|---|
#Tab 2개 만들기 (0) | 2018.12.21 |
#Tab 만들기 (0) | 2018.12.21 |
#tkinter #체크 버튼 #라디오 버튼 만들기 (0) | 2018.12.17 |
#콤보박스 위젯 만들기 (0) | 2018.12.07 |