Open roberthsu2003 opened 2 weeks ago
from ttkthemes import ThemedTk
from tkinter import ttk
class Window(ThemedTk):
def __init__(self,*args,**kwargs):
super().__init__(*args,**kwargs)
self.title('聽說用字體大小做')
style = ttk.Style(self)
#===================TopFrame==============
topFrame = ttk.Frame(self,borderwidth=3,relief='groove')
btn1 = ttk.Button(topFrame,text="按鈕1")
btn1.pack(side='left',expand=True,fill='x',padx=10)
btn2 = ttk.Button(topFrame,text="按鈕2")
btn2.pack(side='left',expand=True,fill='x')
btn3 = ttk.Button(topFrame,text="按鈕3")
btn3.pack(side='left',expand=True,fill='x',padx=10)
topFrame.pack(padx=10,pady=(10,0),expand=True,fill='x')
#===================end TopFrame==============
###############################################################
style.configure('Main1.TButton',font=('Aeial',45))
style.configure('Main2.TButton',font=('Aeial',26))
style.configure('Main3.TButton',font=('Aeial',25))
style.configure('Main4.TButton',font=('Aeial',38))
style.configure('Main5.TButton',font=('Aeial',16))
style.configure('Main6.TButton',font=('Aeial',38))
style.configure('Main7.TButton',font=('Aeial',33))
style.configure('Main8.TButton',font=('Aeial',30))
style.configure('Main9.TButton',font=('Aeial',34))
#===================bottompack==============
bottomFrame = ttk.Frame(self,borderwidth=3,relief='groove')
#===================secction1===============
secction1 = ttk.Frame(self,borderwidth=3,relief='groove')
secction1.pack(padx=10,pady=10,side='left')
x=3
btn4 = ttk.Button(secction1,text="4",style = 'Main1.TButton',width=x)
btn4.pack(fill='x',padx=10,pady=(12,0))
btn5 = ttk.Button(secction1,text="5",style = 'Main2.TButton',width=x)
btn5.pack(fill='x',padx=10,pady=(6,0))
btn6 = ttk.Button(secction1,text="6",style = 'Main3.TButton',width=x)
btn6.pack(fill='x',padx=10,pady=(8,12))
#===================end secction1===========
#===================secction2===============
secction2 = ttk.Frame(self,borderwidth=3,relief='groove')
secction2.pack(padx=10,pady=10,side='left')
btn7 = ttk.Button(secction2,text="7",style = 'Main4.TButton',width=x)
btn7.pack(fill='x',padx=10,pady=(12,0))
btn8 = ttk.Button(secction2,text="8",style = 'Main5.TButton',width=x)
btn8.pack(fill='x',padx=10,pady=(14,0))
btn9 = ttk.Button(secction2,text="9",style = 'Main6.TButton',width=x)
btn9.pack(fill='x',padx=10,pady=(8,12))
#===================end secction1===========
#===================secction3===============
secction3 = ttk.Frame(self,borderwidth=3,relief='groove')
secction3.pack(padx=10,pady=10,side='left')
btn10 = ttk.Button(secction3,text="10",style = 'Main7.TButton',width=x)
btn10.pack(fill='x',padx=10,pady=(0,0))
btn11 = ttk.Button(secction3,text="11",style = 'Main8.TButton',width=x)
btn11.pack(fill='x',padx=10,pady=(8,0))
btn12 = ttk.Button(secction3,text="12",style = 'Main9.TButton',width=x)
btn12.pack(fill='x',padx=10,pady=(16,12))
#===================end secction3==============
bottomFrame.pack(padx=10,pady=10)
#===================end bottompack==============
def main():
window = Window(theme="arc")
window.mainloop()
if __name__ == '__main__':
main()
from ttkthemes import ThemedTk
from tkinter import ttk
class Window(ThemedTk):
def __init__(self,*args,**kwargs):
super().__init__(*args,**kwargs)
self.title('使用ttk的套件')
style = ttk.Style(self)
style.configure('Main.TButton',font=("Arial",15,"bold"),foreground="black")
style.configure('Main1.TButton',font=("Arial",15,"bold"),background="lightblue",foreground="sky blue")
style.configure('Main2.TButton',font=("Arial",15,"italic"),foreground="red")
style.configure('Main3.TButton',font=("Arial",15,"underline"),foreground="violet")
style.configure('Main4.TButton',font=("Arial",15,"overstrike"),foreground="black")
#================================start topframe====================================
topFrame = ttk.Frame(self,borderwidth=1,relief='groove')
btn1 = ttk.Button(topFrame,text="加入購物車",style='Main.TButton')
btn1.pack(side='left',expand=True,fill='both',padx=10)
btn2 = ttk.Button(topFrame,text="我的最愛",style='Main.TButton')
btn2.pack(side='left',expand=True,fill='both')
btn3 = ttk.Button(topFrame,text="個人資料",style='Main.TButton')
btn3.pack(side='left',expand=True,fill='both',padx=10)
topFrame.pack(padx=10,pady=(10,0),ipadx=10,ipady=10,expand=True,fill='both')
#================================end topframe=====================================
#================================start bottomframe================================
bottomFrame = ttk.Frame(self,height=300,borderwidth=1,relief='groove')
#================================start leftframe================================
leftFrame =ttk.Frame(bottomFrame,width=100,height=300,borderwidth=2,relief='groove')
btn1 = ttk.Button(leftFrame,text="Home",style='Main1.TButton')
btn1.pack(expand=True,fill='x',padx=10,pady=5,ipady=50)
btn2 = ttk.Button(leftFrame,text="Cancel",style='Main2.TButton')
btn2.pack(expand=True,fill='x',padx=10,pady=5,ipady=25)
btn3 = ttk.Button(leftFrame,text="Chat",style='Main1.TButton')
btn3.pack(expand=True,fill='x',padx=10,pady=5,ipady=25)
leftFrame.pack(padx=10,pady=10,side="left",expand=True,fill='both')
#================================end leftframe================================
#================================start centerframe================================
centerFrame =ttk.Frame(bottomFrame,width=100,height=300,borderwidth=2,relief='groove')
btn1 = ttk.Button(centerFrame,text="已刪除",style='Main4.TButton')
btn1.pack(expand=True,fill='x',padx=10,pady=5,ipady=40)
btn2 = ttk.Button(centerFrame,text="按鈕2")
btn2.pack(expand=True,fill='x',padx=10,pady=5,ipady=20)
btn3 = ttk.Button(centerFrame,text="已消失",style='Main4.TButton')
btn3.pack(expand=True,fill='x',padx=10,pady=5,ipady=40)
centerFrame.pack(padx=10,pady=10,side="left",expand=True,fill='both')
#================================end centerframe=============================
#================================start rightframe==============================
rightFrame =ttk.Frame(bottomFrame,width=100,height=300,borderwidth=2,relief='groove')
btn1 = ttk.Button(rightFrame,text="按鈕1",style='Main3.TButton')
btn1.pack(expand=True,fill='x',padx=10,pady=5,ipady=33)
btn2 = ttk.Button(rightFrame,text="按鈕2",style='Main3.TButton')
btn2.pack(expand=True,fill='x',padx=10,pady=5,ipady=33)
btn3 = ttk.Button(rightFrame,text="按鈕3",style='Main3.TButton')
btn3.pack(expand=True,fill='x',padx=10,pady=5,ipady=34)
rightFrame.pack(padx=10,pady=10,side="right",expand=True,fill='both')
#================================end rightframe=================================
bottomFrame.pack(padx=10,pady=10,expand=True,fill='both')
#================================end bottomframe==================================
def main():
window = Window(theme="arc")
window.mainloop()
if __name__ == '__main__':
main()
from ttkthemes import ThemedTk
from tkinter import ttk
class Window(ThemedTk):
def __init__(self,*args,**kwargs):
super().__init__(*args,**kwargs)
self.title('使用ttk的套件,這是title')
style = ttk.Style(self)
#=======================strat topframe======================
topFrame = ttk.Frame(self,width=300,height=300,borderwidth=3,relief='groove')
topFrame.pack(padx=10,pady=(10,0),expand=True,fill='x')
btn1 = ttk.Button(topFrame,text='按鈕1')
btn1.pack(side='left',expand=True,fill='x',padx=10)
btn2 = ttk.Button(topFrame,text='按鈕2')
btn2.pack(side='left',expand=True,fill='x',padx=10)
btn3 = ttk.Button(topFrame,text='按鈕3')
btn3.pack(side='left',expand=True,fill='x',padx=10)
#======================end topframe======================
#======================strat bottomframe=====================
bottomFrame1 = ttk.Frame(self,width=500,height=300,borderwidth=3,relief='groove')
bottomFrame1.pack(padx=10,pady=10,side='left')
btnF1_1 = ttk.Button(bottomFrame1,text='按鈕(大)', padding=(30,40))
btnF1_1.pack(side='top',expand=True,fill='x',padx=10)
btnF1_2 = ttk.Button(bottomFrame1,text='按鈕(小)', padding=10)
btnF1_2.pack(side='top',expand=True,fill='x',padx=10)
btnF1_3 = ttk.Button(bottomFrame1,text='按鈕(小)', padding=10)
btnF1_3.pack(side='top',expand=True,fill='x',padx=10)
#======================end bottomframe======================
#======================strat bottomframe======================
bottomFrame2 = ttk.Frame(self,width=500,height=300,borderwidth=3,relief='groove')
bottomFrame2.pack(padx=10,pady=10,side='left')
btnF2_1 = ttk.Button(bottomFrame2,text='按鈕(大)', padding=(30,25))
btnF2_1.pack(side='top',expand=True,fill='x',padx=10)
btnF2_2 = ttk.Button(bottomFrame2,text='按鈕(小)', padding=10)
btnF2_2.pack(side='top',expand=True,fill='x',padx=10)
btnF2_3 = ttk.Button(bottomFrame2,text='按鈕(大)', padding=25)
btnF2_3.pack(side='top',expand=True,fill='x',padx=10)
#======================end bottomframe======================
#======================strat bottomframe======================
bottomFrame3 = ttk.Frame(self,width=500,height=300,borderwidth=3,relief='groove')
bottomFrame3.pack(padx=10,pady=10,side='left')
btnF3_1 = ttk.Button(bottomFrame3,text='按鈕', padding=(30,20))
btnF3_1.pack(side='top',expand=True,fill='x',padx=10)
btnF3_2 = ttk.Button(bottomFrame3,text='按鈕', padding=20)
btnF3_2.pack(side='top',expand=True,fill='x',padx=10)
btnF3_3 = ttk.Button(bottomFrame3,text='按鈕', padding=20)
btnF3_3.pack(side='top',expand=True,fill='x',padx=10)
#======================end bottomframe======================
def main():
window = Window(theme='arc')
window.mainloop()
if __name__ == '__main__':
main()
from ttkthemes import ThemedTk
from tkinter import ttk
class Window(ThemedTk):
def __init__(self,*args,**kwargs):
super().__init__(*args,**kwargs)
self.title('使用ttk的套件')
style = ttk.Style(self)
style.configure("fontmid.TButton",anchor = "center")
#上框
topFrame = ttk.Frame(self,borderwidth=1,relief='groove')
btn1 = ttk.Button(topFrame,text="按鈕1",style="fontmid.TButton")
btn1.pack(side='left',expand=True,fill='x',padx=10)
btn2 = ttk.Button(topFrame,text="按鈕2",style="fontmid.TButton")
btn2.pack(side='left',expand=True,fill='x')
btn3 = ttk.Button(topFrame,text="按鈕3",style="fontmid.TButton")
btn3.pack(side='left',expand=True,fill='x',padx=10)
topFrame.pack(padx=10,pady=(10,0),ipadx=10,ipady=10,expand=True,fill='x')
#end上框
#下框
bottomFrame = ttk.Frame(self,width=500,height=300,borderwidth=1,relief='groove')
bottomFrame.pack(padx=10,pady=10)
#end下框
#下左框
leftbottomFrame1 = ttk.Frame(bottomFrame,width = 160, height=300,borderwidth=1,relief="groove")
bottomleftbtn1 = ttk.Button(leftbottomFrame1,text="按鈕4",style="fontmid.TButton")
bottomleftbtn1.pack(expand=True,fill='y',padx=10,pady=5,ipady=40)
bottomleftbtn2 = ttk.Button(leftbottomFrame1,text="按鈕5",style="fontmid.TButton")
bottomleftbtn2.pack(expand=True,fill='y',padx=10,ipady=15)
bottomleftbtn3 = ttk.Button(leftbottomFrame1,text="按鈕6",style="fontmid.TButton")
bottomleftbtn3.pack(expand=True,fill='y',padx=10,pady=5,ipady=15)
leftbottomFrame1.pack(padx=10,pady=10,side="left")
#end下左框
#下中框
bottombottomFrame2 = ttk.Frame(bottomFrame,width = 160, height=300,borderwidth=1,relief="groove")
bottommidbtn1 = ttk.Button(bottombottomFrame2,text="按鈕7",style="fontmid.TButton")
bottommidbtn1.pack(expand=True,fill='y',padx=10,pady=5,ipady=30)
bottommidbtn2 = ttk.Button(bottombottomFrame2,text="按鈕8",style="fontmid.TButton")
bottommidbtn2.pack(expand=True,fill='y',padx=10,ipady=10)
bottommidbtn3 = ttk.Button(bottombottomFrame2,text="按鈕9",style="fontmid.TButton")
bottommidbtn3.pack(expand=True,fill='y',padx=10,pady=5,ipady=30)
bottombottomFrame2.pack(padx=10,pady=10,side="left")
#end下中框
#下右框
rightbottomFrame3 = ttk.Frame(bottomFrame,width = 160, height=300,borderwidth=1,relief="groove")
bottomrightbtn1 = ttk.Button(rightbottomFrame3,text="按鈕10",style="fontmid.TButton")
bottomrightbtn1.pack(expand=True,fill='y',padx=10,pady=5,ipady=23.3)
bottomrightbtn2 = ttk.Button(rightbottomFrame3,text="按鈕11",style="fontmid.TButton")
bottomrightbtn2.pack(expand=True,fill='y',padx=10,ipady=23.3)
bottomrightbtn3 = ttk.Button(rightbottomFrame3,text="按鈕12",style="fontmid.TButton")
bottomrightbtn3.pack(expand=True,fill='y',padx=10,pady=5,ipady=23.3)
rightbottomFrame3.pack(padx=10,pady=10,side="left")
#end下右框
def main():
window = Window(theme="black")
window.mainloop()
if __name__ == '__main__':
main()
Code
from ttkthemes import ThemedTk
from tkinter import ttk
class Window(ThemedTk):
def __init__(self,*args,**kwargs):
super().__init__(*args,**kwargs)
self.title('Lesson 4 ')
style = ttk.Style(self)
style.configure('button.TButton',font=('Helvetica',30))
#=============Start of topframe===================
topFrame = ttk.Frame(self,borderwidth=1,relief="groove")
btn1 = ttk.Button(topFrame,text='botton 01')
btn1.pack(side='left',expand=True,fill='x',padx=10)
btn2 = ttk.Button(topFrame,text='botton 02')
btn2.pack(side='left',expand=True,fill='x',padx=10)
btn3 = ttk.Button(topFrame,text='botton 03')
btn3.pack(side='left',expand=True,fill='x',padx=10)
topFrame.pack(padx=10,pady=(10,0),ipadx=10,ipady=10,expand=True,fill='x')
#=============end of topframe===================
#=============start of bottomeframe=============
bottomFrame = ttk.Frame(self,borderwidth=1,relief="groove",width=500,height=300)
#==========start of bottmeframe1 ==================
bottomFrame1 = ttk.Frame(bottomFrame,borderwidth=1,relief="groove",width=500,height=300)
btn4 = ttk.Button(bottomFrame1,text='botton 04',style='button.TButton')
btn4.pack(side='top',expand=True,fill='x',padx=10)
btn5 = ttk.Button(bottomFrame1,text='botton 05')
btn5.pack(side='top',expand=True,fill='x',padx=10,pady=15)
btn6 = ttk.Button(bottomFrame1,text='botton 06')
btn6.pack(side='top',expand=True,fill='x',padx=10,pady=15)
bottomFrame1.pack(padx=10,pady=10,ipadx=10,ipady=10,expand=True,fill='x',side='left')
#========== end of bottmeframe1 ==================
#==========start of bottmeframe2 ==================
bottomFrame2 = ttk.Frame(bottomFrame,borderwidth=1,relief="groove",width=500,height=300)
btn7 = ttk.Button(bottomFrame2,text='botton 07',style='button.TButton')
btn7.pack(side='top',expand=True,fill='x',padx=10)
btn8 = ttk.Button(bottomFrame2,text='botton 08')
btn8.pack(side='top',expand=True,fill='x',padx=10,pady=15)
btn9 = ttk.Button(bottomFrame2,text='botton 09',style='button.TButton')
btn9.pack(side='top',expand=True,fill='x',padx=10)
bottomFrame2.pack(padx=10,pady=10,ipadx=10,ipady=10,expand=True,fill='x',side='left')
#========== end of bottmeframe2 ==================
#==========start of bottmeframe3 ==================
bottomFrame3 = ttk.Frame(bottomFrame,borderwidth=1,relief="groove",width=500,height=300)
btn10 = ttk.Button(bottomFrame3,text='botton 10',style='button.TButton')
btn10.pack(side='top',expand=True,fill='x',padx=10)
btn11 = ttk.Button(bottomFrame3,text='botton 11',style='button.TButton')
btn11.pack(side='top',expand=True,fill='x',padx=10)
btn12 = ttk.Button(bottomFrame3,text='botton 12',style='button.TButton')
btn12.pack(side='top',expand=True,fill='x',padx=10)
bottomFrame3.pack(padx=10,pady=10,ipadx=10,ipady=10,expand=True,fill='x',side='left')
#========== end of bottmeframe3 ==================
bottomFrame.pack(padx=10,pady=10,ipadx=10,ipady=10,expand=True,fill='x')
#=============enf of bottomeframe=============
def main():
window=Window(theme='ark')
window.mainloop()
if __name__=='__main__':
main()
from ttkthemes import ThemedTk
from tkinter import ttk
class Window(ThemedTk):
def __init__(self,*args,**kwargs):
super().__init__(*args,**kwargs)
self.title('世界最多人去旅遊的國家及地區')
style = ttk.Style(self)
# ================ top frame ==========================
topFrame = ttk.Frame(self,borderwidth=1,relief='groove')
# expand is for space holder,fill = 'x' for left and right
topFrame.pack(padx=10,pady=(10,0),ipadx=10,ipady=10,expand=True,fill='x')
btn1 = ttk.Button(topFrame,text="歐洲")
btn1.pack(side='left',expand=True,fill='x',padx=10)
btn2 = ttk.Button(topFrame,text="北美")
btn2.pack(side='left',expand=True,fill='x')
btn3 = ttk.Button(topFrame,text="亞洲")
btn3.pack(side='left',expand=True,fill='x',padx=10)
# ================ end of top frame ====================
# =============== bottom frame =======================
bottomFrame = ttk.Frame(self,width=500,height=300,borderwidth=1,relief='sunken') # bottom frame ---------
bottomFrame.pack(padx=5,pady=10,expand=True,fill='y') # extend for upper and bottom
# create 3 columns in bottom frame
for i in range(3):
bottomFrame.columnconfigure(i,weight=1)
bottomFrame.rowconfigure(0,weight=1)
# Create a style object
style = ttk.Style()
# Define a new style for the buttons
style.configure("Bold.TButton", font=("Helvetica", 40, "bold"), foreground="red", background="green")
# Set a different background when the button is clicked or hovered over (optional)
style.map("Bold.TButton", background=[("active", "lightblue"), ("pressed", "blue")])
# List of the top 9 most popular travel destinations (replace these with the latest list if necessary)
countries = [
"法國", "西班牙", "土耳其", "中國", "義大利",
"美國", "墨西哥", "德國", "泰國"
]
# Initialize a country counter
country_counter = 0
# create a frame in each column
for col in range(3):
column_frame = ttk.Frame(bottomFrame,relief='groove',borderwidth=2)
column_frame.grid(row=0,column=col,sticky='nsew',padx=5)
column_frame.columnconfigure(0,weight=1)
if col == 0: # left column
sizes = ["biggest",'small','small']
elif col == 1: # middle column
sizes = ["bigger","small","bigger"]
else: # right column
sizes = ["middle","middle","middle"]
# add buttons in each column
for row, size in enumerate(sizes):
if country_counter < len(countries):
country_name = countries[country_counter]
btn = ttk.Button(column_frame, text=f" {country_name}\n\n Botton: {size}")
if size == "biggest":
btn.grid(row=row, column=0, sticky="nsew", padx=5, pady=2, ipady=30)
column_frame.rowconfigure(row, weight=3)
elif size == "bigger":
btn.grid(row=row, column=0, sticky="nsew", padx=5, pady=2, ipady=20)
column_frame.rowconfigure(row, weight=2)
elif size == "middle":
btn.grid(row=row, column=0, sticky="nsew", padx=5, pady=2, ipady=5)
column_frame.rowconfigure(row, weight=1)
else:
btn.grid(row=row, column=0, sticky="nsew", padx=5, pady=1, ipady=5)
column_frame.rowconfigure(row, weight=1)
# Increment the country counter after placing each button
country_counter += 1
# ================= end of bottom frame ======================
def main():
window = Window(theme="arc")
window.mainloop()
if __name__ == '__main__':
main()
from ttkthemes import ThemedTk
from tkinter import ttk
class Window(ThemedTk):
def __init__(self,*args,**kwargs):
super().__init__(*args,**kwargs)
self.title('使用ttk的套件')
style = ttk.Style(self)
style.configure('underline.TButton',font=("Calibri",15,"underline"),foreground="blue")
style.configure('italic.TButton',font=("Calibri",15,"italic"),foreground="lightblue")
style.configure('bold.TButton',font=("Calibri",15,"bold"),foreground="sky blue")
topFrame = ttk.Frame(self,borderwidth=1,relief='groove')
btn1 = ttk.Button(topFrame,text="按鈕1")
btn1.pack(side='left',expand=True,fill='x',padx=10)
btn2 = ttk.Button(topFrame,text="按鈕2")
btn2.pack(side='left',expand=True,fill='x')
btn3 = ttk.Button(topFrame,text="按鈕3")
btn3.pack(side='left',expand=True,fill='x',padx=10)
topFrame.pack(padx=10,pady=(10,0),ipadx=10,ipady=10,expand=True,fill='x')
bottomFrame = ttk.Frame(self,borderwidth=1,relief='groove')
bottomFrame1 = ttk.Frame(bottomFrame,borderwidth=1,relief='groove')
btn4 = ttk.Button(bottomFrame1,text="按鈕4",style='underline.TButton')
btn4.pack(expand=True,fill='y',padx=10)
btn5 = ttk.Button(bottomFrame1,text="按鈕5",style='underline.TButton')
btn5.pack(expand=False,fill='y',padx=10)
btn6 = ttk.Button(bottomFrame1,text="按鈕6",style='underline.TButton')
btn6.pack(expand=False,fill='y',padx=10)
bottomFrame1.pack(side='left',padx=10,pady=(10,0),ipadx=10,ipady=10,expand=True,fill='y')
bottomFrame2 = ttk.Frame(bottomFrame,borderwidth=1,relief='groove')
btn7 = ttk.Button(bottomFrame2,text="按鈕7",style='italic.TButton')
btn7.pack(expand=True,fill='y',padx=10)
btn8 = ttk.Button(bottomFrame2,text="按鈕8",style='italic.TButton')
btn8.pack(expand=False,fill='y',padx=10)
btn9 = ttk.Button(bottomFrame2,text="按鈕9",style='italic.TButton')
btn9.pack(expand=True,fill='y',padx=10)
bottomFrame2.pack(side='left',padx=10,pady=(10,0),ipadx=10,ipady=10,expand=True,fill='y')
bottomFrame3 = ttk.Frame(bottomFrame,borderwidth=1,relief='groove')
btn10 = ttk.Button(bottomFrame3,text="按鈕10",style='bold.TButton')
btn10.pack(expand=True,fill='y',padx=10)
btn11 = ttk.Button(bottomFrame3,text="按鈕11",style='bold.TButton')
btn11.pack(expand=True,fill='y',padx=10)
btn12 = ttk.Button(bottomFrame3,text="按鈕12",style='bold.TButton')
btn12.pack(expand=True,fill='y',padx=10)
bottomFrame3.pack(side='left',padx=10,pady=(10,0),ipadx=10,ipady=10,expand=True,fill='y')
bottomFrame.pack(padx=10,pady=(10,0),ipadx=10,ipady=10,expand=True,fill='y')
def main():
window = Window(theme="arc")
window.mainloop()
if __name__ == '__main__':
main()
from ttkthemes import ThemedTk #現成的css
from tkinter import ttk
class Window(ThemedTk):
def __init__(self,**kwargs):
super().__init__(**kwargs)
self.title()
self.title("有夠可愛")
style=ttk.Style(self)
#===================TOP FRAME==================================================================#
topFrame=ttk.Frame(self,borderwidth=1,relief='groove')
btn1=ttk.Button(topFrame,text='button1')#在topFrame放進btn1,原本設定的frame寬高就沒了
btn1.pack(side='left',padx=10,expand=True)#從左向右排
btn2=ttk.Button(topFrame,text='button2')
btn2.pack(side='left',padx=10,expand=True)
btn3=ttk.Button(topFrame,text='button3')
btn3.pack(side='left',padx=10,expand=True)
topFrame.pack(ipadx=10,expand=True,fill='x')#空間定位下在frame pack裡面
#==================End TOP FRAME====================================================#
#===================BOTTOM FRAME===============================================================#
buttomFrame=ttk.Frame(self,borderwidth=1,relief='groove')
#===================BOTTOM FRAME LEFT===============================================================#
buttomFrameL=ttk.Frame(self,borderwidth=1,relief='groove')
btn4=ttk.Button(buttomFrameL,text='button4')
btn4.pack(side='top',ipady=30,padx=5,pady=(10,5))
btn5=ttk.Button(buttomFrameL,text='button5')
btn5.pack(side='top',ipady=10,padx=5,pady=5)
btn6=ttk.Button(buttomFrameL,text='button6')
btn6.pack(side='top',ipady=10,padx=5,pady=(5,10))
buttomFrameL.pack(side='left',expand=True,fill='y',padx=10)
#===================End BOTTOM FRAME LEFT===============================================================#
#===================BOTTOM FRAME CENTER===============================================================#
buttomFrameC=ttk.Frame(self,borderwidth=1,relief='groove')
btn7=ttk.Button(buttomFrameC,text='button7')
btn7.pack(side='top',ipady=22,padx=(5,8),pady=(5,10))
btn8=ttk.Button(buttomFrameC,text='button8')
btn8.pack(side='top',ipady=5,padx=(5,8),pady=5)
btn9=ttk.Button(buttomFrameC,text='button9')
btn9.pack(side='top',ipady=25,padx=(5,8),pady=5)
buttomFrameC.pack(side='left',expand=True,fill='y',padx=10)
#===================End BOTTOM FRAME CENTER===============================================================#
#===================BOTTOM FRAME RIGHT===============================================================#
buttomFrameR=ttk.Frame(self,borderwidth=1,relief='groove')
btn10=ttk.Button(buttomFrameR,text='button9')
btn10.pack(side='top',ipady=15,padx=5,pady=(0,10))
btn11=ttk.Button(buttomFrameR,text='button10')
btn11.pack(side='top',ipady=15,padx=5,pady=10)
btn12=ttk.Button(buttomFrameR,text='button11')
btn12.pack(side='top',ipady=15,padx=5,pady=10)
buttomFrameR.pack(side='left',expand=True,fill='y',padx=10)
#===================End BOTTOM FRAME Right===============================================================#
buttomFrame.pack(expand=True,fill='x')
#===================End BOTTOM FRAME===============================================================#
def main():
root=Window(theme='breeze')
root.mainloop()
if __name__=='__main__':
main()
from ttkthemes import ThemedTk
from tkinter import ttk
class Window(ThemedTk):
def __init__(self,*args,**kwargs):
super().__init__(*args,**kwargs)
self.title('孫榕陽的lesson4作業')
style = ttk.Style(self)
frame_width = 200
#============上部按鈕區域開始================================================
topFrame = ttk.Frame(self,width=frame_width, borderwidth=1, relief='groove')
btn1 = ttk.Button(topFrame, text="按鈕1")
btn1.pack(side='left',fill='x', padx=10,pady=5)
btn2 = ttk.Button(topFrame, text="按鈕2")
btn2.pack(side='left', fill='x', padx=30,pady=5)
btn3 = ttk.Button(topFrame, text="按鈕3")
btn3.pack(side='left', fill='x', padx=10,pady=5)
topFrame.pack(side="top",expand=True,padx=10, pady=10,fill='both')
#============上部按鈕區域結束================================================
#============下部按鈕區域開始================================================
bottomFrame = ttk.Frame(self,width=frame_width, borderwidth=1, relief='groove')
bottomFrame.pack(side="top",expand=True,padx=10, pady=10,fill='both')
#============下部按鈕區域結束================================================
#============左邊按鈕區域開始================================================
leftFrame = ttk.Frame(bottomFrame, width=frame_width, borderwidth=1, relief='groove')
btn4 = ttk.Button(leftFrame, text="按鈕4")
btn4.pack(side='top',expand=True,fill='both',padx=10,pady=5,ipady=30)
btn5 = ttk.Button(leftFrame, text="按鈕5")
btn5.pack(side='top',expand=True,fill='both',padx=10,pady=5,ipady=10)
btn6 = ttk.Button(leftFrame, text="按鈕6")
btn6.pack(side='top',expand=True,fill='both',padx=10,pady=5,ipady=10)
leftFrame.pack(side='left', padx=10, pady=10, fill='both', expand=True)
#============左邊按鈕區域結束================================================
#============中間按鈕區域開始================================================
centerFrame = ttk.Frame(bottomFrame, width=frame_width, borderwidth=1, relief='groove')
btn7 = ttk.Button(centerFrame, text="按鈕7")
btn7.pack(side='top',expand=True,fill='both',padx=10,pady=5,ipady=30)
btn8 = ttk.Button(centerFrame, text="按鈕8")
btn8.pack(side='top',expand=True,fill='both',padx=10,pady=5,ipady=10)
btn9 = ttk.Button(centerFrame, text="按鈕9")
btn9.pack(side='top',expand=True,fill='both',padx=10,pady=5,ipady=30)
centerFrame.pack(side="left", padx=10, pady=10,fill='both', expand=True)
#============中間按鈕區域結束================================================
#============右邊按鈕區域開始================================================
rightFrame = ttk.Frame(bottomFrame, width=frame_width, borderwidth=1, relief='groove')
btn10 = ttk.Button(rightFrame, text="按鈕10")
btn10.pack(side='top',expand=True,fill='both',padx=10,pady=5,ipady=20)
btn11 = ttk.Button(rightFrame, text="按鈕11")
btn11.pack(side='top',expand=True,fill='both',padx=10,pady=5,ipady=20)
btn12 = ttk.Button(rightFrame, text="按鈕12")
btn12.pack(side='top',expand=True,fill='both',padx=10,pady=5,ipady=20)
rightFrame.pack(side="left", padx=10, pady=10,fill='both', expand=True)
#============右邊按鈕區域結束================================================
def main():
window = Window(theme="arc")
window.mainloop()
if __name__ == '__main__':
main()
from ttkthemes import ThemedTk
from tkinter import ttk
from ttkthemes import ThemedTk
from tkinter import ttk
class Window(ThemedTk):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.title('homework')
style = ttk.Style(self)
# ===================TOP FRAME==================================================================#
topFrame = ttk.Frame(self, borderwidth=1, relief='groove')
btn1 = ttk.Button(topFrame, text="按鈕1")
btn1.pack(side='left', expand=True, fill='x', padx=10)
btn2 = ttk.Button(topFrame, text="按鈕2")
btn2.pack(side='left', expand=True, fill='x')
btn3 = ttk.Button(topFrame, text="按鈕3")
btn3.pack(side='left', expand=True, fill='x', padx=10)
topFrame.pack(padx=10, pady=(10, 0), ipadx=10,
ipady=10, expand=True, fill='x')
# ==================End TOP FRAME====================================================#
# ===================BOTTOM FRAME====================================================
bottomFrame = ttk.Frame(self, borderwidth=1,
height=2000, relief='groove')
bottomFrame.pack(padx=10, pady=10, expand=True, fill='x')
f1 = ttk.Frame(bottomFrame, borderwidth=3, relief='groove')
f2 = ttk.Frame(bottomFrame, borderwidth=3, relief='groove')
f3 = ttk.Frame(bottomFrame, borderwidth=3, relief='groove')
f1.pack(side='left', padx=10, expand=True, fill='both')
f2.pack(side='left', padx=10, expand=True, fill='both')
f3.pack(side='left', padx=10, expand=True, fill='both')
btna1 = ttk.Button(f1, text="按鈕1")
btna1.pack(fill='x', padx=10, pady=(5, 5), ipady=50)
btna2 = ttk.Button(f1, text="按鈕2")
btna2.pack(fill='x', padx=10, pady=(5, 5), ipady=25)
btna3 = ttk.Button(f1, text="按鈕3")
btna3.pack(fill='x', padx=10, pady=(5, 5), ipady=25)
btnb1 = ttk.Button(f2, text="按鈕1")
btnb1.pack(fill='x', padx=10, pady=(5, 5), ipady=40)
btnb2 = ttk.Button(f2, text="按鈕2")
btnb2.pack(fill='x', padx=10, pady=(5, 5), ipady=20)
btnb3 = ttk.Button(f2, text="按鈕3")
btnb3.pack(fill='x', padx=10, pady=(5, 5), ipady=40)
btnc1 = ttk.Button(f3, text="按鈕1")
btnc1.pack(fill='x', padx=10, pady=(5, 5), ipady=100/3)
btnc2 = ttk.Button(f3, text="按鈕2")
btnc2.pack(fill='x', padx=10, pady=(5, 5), ipady=100/3)
btnc3 = ttk.Button(f3, text="按鈕3")
btnc3.pack(fill='x', padx=10, pady=(5, 5), ipady=100/3)
# ===================End BOTTOM FRAME===============================================================#
def main():
window = Window(theme="arc")
window.mainloop()
if __name__ == '__main__':
main()
from ttkthemes import ThemedTk from tkinter import ttk, messagebox
class DessertWindow(ThemedTk): def init(self, *args, *kwargs): super().init(args, **kwargs) self.title('美味甜點') self.geometry('800x600')
style = ttk.Style(self)
style.configure('TButton', font=('Arial', 20))
self.create_widgets()
def create_widgets(self):
# 上框架
top_frame = ttk.Frame(self, borderwidth=3, relief='groove')
top_frame.pack(padx=10, pady=(10, 0), expand=True, fill='x')
desserts = ["蛋糕", "冰淇淋", "巧克力"]
for dessert in desserts:
btn = ttk.Button(top_frame, text=dessert, command=lambda d=dessert: self.show_info(d))
btn.pack(side='left', expand=True, fill='x', padx=10)
# 下框架
categories = ["西式甜點", "東方甜品", "特色小吃"]
for category in categories:
frame = ttk.Frame(self, borderwidth=3, relief='groove')
frame.pack(padx=10, pady=10, side='left', fill='y', expand=True)
self.create_category_buttons(frame, category)
def create_category_buttons(self, parent, category):
items = {
"西式甜點": ["提拉米蘇", "舒芙蕾", "奶油泡芙"],
"東方甜品": ["豆花", "芒果糯米飯", "紅豆湯圓"],
"特色小吃": ["鳳梨酥", "蛋塔", "綠豆糕"]
}
for item in items[category]:
btn = ttk.Button(parent, text=item, command=lambda i=item: self.show_info(i))
btn.pack(fill='x', padx=10, pady=(5, 5))
def show_info(self, item):
info = {
"蛋糕": "鬆軟可口,多種口味可選。",
"冰淇淋": "清涼爽口,夏日必備。",
"巧克力": "香濃醇厚,難以抗拒的美味。",
"提拉米蘇": "意大利經典甜點,咖啡味十足。",
"舒芙蕾": "輕盈如雲的法式甜點。",
"奶油泡芙": "酥脆外皮,內餡滑順。",
"豆花": "滑嫩香甜,豆香濃郁。",
"芒果糯米飯": "香甜芒果搭配黏糯米飯。",
"紅豆湯圓": "溫暖甜蜜,冬日最愛。",
"鳳梨酥": "台灣特產,酥脆外皮包裹酸甜內餡。",
"蛋塔": "香酥蛋奶味,葡式經典。",
"綠豆糕": "清涼解暑,口感細膩。"
}
messagebox.showinfo(item, info.get(item, "暫無相關信息"))
def main(): window = DessertWindow(theme="arc") window.mainloop()
if name == 'main': main()
from ttkthemes import ThemedTk
from tkinter import ttk
from ttkthemes import ThemedTk
from tkinter import ttk
class Window(ThemedTk):
def __init__(self,*args,**kwargs):
super().__init__(*args,**kwargs)
self.title('使用ttk的套件')
style = ttk.Style(self)
topFrame = ttk.Frame(self,borderwidth=1,relief='groove')
btn1 = ttk.Button(topFrame,text="按鈕1")
btn1.pack(side='left',expand=True,fill='x',padx=10)
btn2 = ttk.Button(topFrame,text="按鈕2")
btn2.pack(side='left',expand=True,fill='x')
btn3 = ttk.Button(topFrame,text="按鈕3")
btn3.pack(side='left',expand=True,fill='x',padx=10)
topFrame.pack(padx=10,pady=(10,0),ipadx=10,ipady=10,expand=True,fill='x')
bottomFrame = ttk.Frame(self,borderwidth=1,height=2000,relief='groove')
bottomFrame.pack(padx=10,pady=10,expand=True,fill='x')
f1 = ttk.Frame(bottomFrame,borderwidth=3,relief='groove')
f2 = ttk.Frame(bottomFrame,borderwidth=3,relief='groove')
f3 = ttk.Frame(bottomFrame,borderwidth=3,relief='groove')
f1.pack(side='left', padx=10, expand=True,fill='both')
f2.pack(side='left', padx=10, expand=True,fill='both')
f3.pack(side='left', padx=10, expand=True,fill='both')
btna1 = ttk.Button(f1,text="按鈕1")
btna1.pack(fill='x', padx=10, pady=(5, 5), ipady=50)
btna2 = ttk.Button(f1,text="按鈕2")
btna2.pack(fill='x', padx=10, pady=(5, 5), ipady=25)
btna3 = ttk.Button(f1,text="按鈕3")
btna3.pack(fill='x', padx=10, pady=(5, 5), ipady=25)
btnb1 = ttk.Button(f2,text="按鈕1")
btnb1.pack(fill='x', padx=10, pady=(5, 5), ipady=40)
btnb2 = ttk.Button(f2,text="按鈕2")
btnb2.pack(fill='x', padx=10, pady=(5, 5), ipady=20)
btnb3 = ttk.Button(f2,text="按鈕3")
btnb3.pack(fill='x', padx=10, pady=(5, 5), ipady=40)
btnc1 = ttk.Button(f3,text="按鈕1")
btnc1.pack(fill='x', padx=10, pady=(5, 5), ipady=100/3)
btnc2 = ttk.Button(f3,text="按鈕2")
btnc2.pack(fill='x', padx=10, pady=(5, 5), ipady=100/3)
btnc3 = ttk.Button(f3,text="按鈕3")
btnc3.pack(fill='x', padx=10, pady=(5, 5), ipady=100/3)
def main():
window = Window(theme="arc")
window.mainloop()
if __name__ == '__main__':
main()
from ttkthemes import ThemedTk
from tkinter import ttk
class Window:
def __init__(self, root):
root.title("餘興味")
root.geometry("600x400")
style = ttk.Style(root)
style.configure('big.TButton', font=("Calibri", 15, "bold"), foreground="blue")
style.configure('medium.TButton', font=("Calibri", 12, "normal"), foreground="green")
style.configure('small.TButton', font=("Calibri", 10, "normal"), foreground="red")
top_frame = ttk.Frame(root)
top_frame.pack(side='top', fill='x', padx=5, pady=5)
btn1 = ttk.Button(top_frame, text="這是按鈕", style='big.TButton')
btn1.pack(side='left', padx=5,expand=True,fill='x')
btn2 = ttk.Button(top_frame, text="按鈕", style='medium.TButton')
btn2.pack(side='left', padx=5,expand=True,fill='x')
btn3 = ttk.Button(top_frame, text="還是按鈕", style='small.TButton')
btn3.pack(side='left', padx=5,expand=True,fill='x')
bottom_frame = ttk.Frame(root)
bottom_frame.pack(side='top', fill='both', expand=True, padx=5, pady=5)
left_frame = ttk.Frame(bottom_frame, borderwidth=1, relief="solid")
left_frame.pack(side='left', fill='both', expand=True, padx=5, pady=5)
big_button1 = ttk.Button(left_frame, text="(・ω´・ )", style='big.TButton')
big_button1.pack(fill='both', expand=True, padx=5, pady=5,ipady=20)
middle_button1 = ttk.Button(left_frame, text='σ`∀´)σ',style='small.TButton')
middle_button1.pack(fill='both', expand=True,padx=5,pady=5)
middle_button2 = ttk.Button(left_frame, text='(゚д゚≡゚д゚)',style='small.TButton')
middle_button2.pack(fill='both', expand=True,padx=5,pady=5)
middle_frame = ttk.Frame(bottom_frame, borderwidth=1, relief="solid")
middle_frame.pack(side='left', fill='both', expand=True, padx=5, pady=5)
big_button2 = ttk.Button(middle_frame, text="(゜皿。)", style='big.TButton')
big_button2.pack(fill='both', expand=True, padx=5, pady=5)
small_button1 = ttk.Button(middle_frame, text="Σ(*゚д゚ノ)ノ", style='small.TButton')
small_button1.pack(fill='both', expand=True, padx=5, pady=5)
small_button2 = ttk.Button(middle_frame, text="(´・ω・`)", style='small.TButton')
small_button2.pack(fill='both', expand=True, padx=5, pady=5,ipady=20)
right_frame = ttk.Frame(bottom_frame, borderwidth=1, relief="solid")
right_frame.pack(side='left', fill='both', expand=True, padx=5, pady=5)
small_button3 = ttk.Button(right_frame, text="(っ・Д・)っ", style='small.TButton')
small_button3.pack(fill='both', expand=True, padx=5, pady=5)
small_button4 = ttk.Button(right_frame, text="(つд⊂)", style='small.TButton')
small_button4.pack(fill='both', expand=True, padx=5, pady=5)
small_button4 = ttk.Button(right_frame, text="ಠ_ಠ", style='small.TButton')
small_button4.pack(fill='both', expand=True, padx=5, pady=5)
def main():
root = ThemedTk(theme="breeze")
app = Window(root)
root.mainloop()
if __name__ == "__main__":
main()
from ttkthemes import ThemedTk # 引入 ThemedTk,這是 tkinter 的一個擴展,提供了多種主題。
from tkinter import ttk # 引入 ttk 模組,這是 tkinter 的一部分,用於製作現代化的 GUI 小部件。
class Window(ThemedTk):
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self.title('使用ttk的套件') # 設定視窗的標題。
# 設定按鈕樣式
style = ttk.Style(self) # 使用 self 來創建與這個視窗相關聯的 Style 物件。
style.configure('underline.TButton', font=(
"arial", 15, "underline"), foreground="black") # 定義下劃線樣式的按鈕。
style.configure('italic.TButton', font=(
"arial", 15, "italic"), foreground="black") # 定義斜體樣式的按鈕。
style.configure('bold.TButton', font=(
"arial", 15, "bold"), foreground="black") # 定義粗體樣式的按鈕。
# 創建上方框架
# self 代表當前視窗,作為 Frame 的父容器。
topFrame = ttk.Frame(self, borderwidth=5, relief='raised')
btn1 = ttk.Button(topFrame, text="按鈕1") # 在 topFrame 中創建按鈕1。
btn1.pack(side='left', expand=True, fill='x', padx=10) # 設定按鈕1的布局。
btn2 = ttk.Button(topFrame, text="按鈕2") # 在 topFrame 中創建按鈕2。
btn2.pack(side='left', expand=True, fill='x') # 設定按鈕2的布局。
btn3 = ttk.Button(topFrame, text="按鈕3") # 在 topFrame 中創建按鈕3。
btn3.pack(side='left', expand=True, fill='x', padx=10) # 設定按鈕3的布局。
topFrame.pack(padx=10, pady=(10, 0), ipadx=10, ipady=10,
expand=True, fill='x') # 設定 topFrame 的布局。
# 創建下方框架
# self 代表當前視窗,作為 Frame 的父容器。
bottomFrame = ttk.Frame(self, borderwidth=5, relief='raised')
# 創建下方的子框架1
# bottomFrame 作為子框架的父容器。
bottomFrame1 = ttk.Frame(bottomFrame, borderwidth=5, relief='raised')
# 在 bottomFrame1 中創建按鈕4,使用下劃線樣式。
btn4 = ttk.Button(bottomFrame1, text="按鈕4", style='underline.TButton')
btn4.pack(expand=True, fill='y', padx=10) # 設定按鈕4的布局。
# 在 bottomFrame1 中創建按鈕5,使用下劃線樣式。
btn5 = ttk.Button(bottomFrame1, text="按鈕5", style='underline.TButton')
btn5.pack(expand=False, fill='y', padx=10) # 設定按鈕5的布局。
# 在 bottomFrame1 中創建按鈕6,使用下劃線樣式。
btn6 = ttk.Button(bottomFrame1, text="按鈕6", style='underline.TButton')
btn6.pack(expand=False, fill='y', padx=10) # 設定按鈕6的布局。
bottomFrame1.pack(side='left', padx=10, pady=(
10, 0), ipadx=10, ipady=10, expand=True, fill='y') # 設定 bottomFrame1 的布局。
# 創建下方的子框架2
# bottomFrame 作為子框架的父容器。
bottomFrame2 = ttk.Frame(bottomFrame, borderwidth=5, relief='groove')
# 在 bottomFrame2 中創建按鈕7,使用斜體樣式。
btn7 = ttk.Button(bottomFrame2, text="按鈕7", style='italic.TButton')
btn7.pack(expand=True, fill='y', padx=10) # 設定按鈕7的布局。
# 在 bottomFrame2 中創建按鈕8,使用斜體樣式。
btn8 = ttk.Button(bottomFrame2, text="按鈕8", style='italic.TButton')
btn8.pack(expand=False, fill='y', padx=10) # 設定按鈕8的布局。
# 在 bottomFrame2 中創建按鈕9,使用斜體樣式。
btn9 = ttk.Button(bottomFrame2, text="按鈕9", style='italic.TButton')
btn9.pack(expand=True, fill='y', padx=10) # 設定按鈕9的布局。
bottomFrame2.pack(side='left', padx=10, pady=(
10, 0), ipadx=10, ipady=10, expand=True, fill='y') # 設定 bottomFrame2 的布局。
# 創建下方的子框架3
# bottomFrame 作為子框架的父容器。
bottomFrame3 = ttk.Frame(bottomFrame, borderwidth=5, relief='raised')
# 在 bottomFrame3 中創建按鈕10,使用粗體樣式。
btn10 = ttk.Button(bottomFrame3, text="按鈕10", style='bold.TButton')
btn10.pack(expand=True, fill='y', padx=10) # 設定按鈕10的布局。
# 在 bottomFrame3 中創建按鈕11,使用粗體樣式。
btn11 = ttk.Button(bottomFrame3, text="按鈕11", style='bold.TButton')
btn11.pack(expand=True, fill='y', padx=10) # 設定按鈕11的布局。
# 在 bottomFrame3 中創建按鈕12,使用粗體樣式。
btn12 = ttk.Button(bottomFrame3, text="按鈕12", style='bold.TButton')
btn12.pack(expand=True, fill='y', padx=10) # 設定按鈕12的布局。
bottomFrame3.pack(side='left', padx=10, pady=(
10, 0), ipadx=10, ipady=10, expand=True, fill='y') # 設定 bottomFrame3 的布局。
bottomFrame.pack(padx=10, pady=(10, 0), ipadx=10, ipady=10,
expand=True, fill='y') # 設定 bottomFrame 的布局。
def main():
window = Window(theme="arc") # 創建一個 Window 實例,使用 "arc" 主題。
window.mainloop() # 開始事件循環,使窗口保持顯示。
if __name__ == '__main__':
main() # 執行 main 函數。我覺得框線沒有很清楚
from tkinter import ttk
from ttkthemes import ThemedTk
class Window(ThemedTk):
def __init__(self,*args,**kwargs):
super().__init__(*args,**kwargs)
self.title('按鈕123456789101112')
#style==================================================
style = ttk.Style(self)
style.configure('bottom.TFrame', background='lightgreen')
#end style==============================================
#topFrame=======================================================
topFrame = ttk.Frame(self,borderwidth=1,relief='groove')
btn1 = ttk.Button(topFrame,text='左上')
btn1.pack(side='left',expand=True,fill='x',padx=10)
btn2 = ttk.Button(topFrame,text='中上')
btn2.pack(side='left',expand=True,fill='x')
btn3 = ttk.Button(topFrame,text='右上')
btn3.pack(side='left',expand=True,fill='x',padx=10)
topFrame.pack(padx=10,pady=(10,0),ipady=10,fill='x')
#end topFrame===================================================
#bottomFrame=====================================================================
bottomFrame = ttk.Frame(self,borderwidth=1,relief='groove')
#leftFrame============================================================================
leftFrame = ttk.Frame(bottomFrame,borderwidth=1,relief='groove',style='bottom.TFrame')
btn4 = ttk.Button(leftFrame,text='下左上')
btn4.pack(expand=True,fill='both',padx=5,pady=5,ipady=25)
btn5 = ttk.Button(leftFrame,text='下左中')
btn5.pack(expand=True,fill='both',padx=5,ipady=10)
btn6 = ttk.Button(leftFrame,text='下左下')
btn6.pack(expand=True,fill='both',padx=5,pady=5,ipady=10)
leftFrame.pack(side='left',padx=10,pady=10,expand=True,fill='both')
#end leftFrame========================================================================
#centerFrame============================================================================
centerFrame = ttk.Frame(bottomFrame,borderwidth=1,relief='groove',style='bottom.TFrame')
btn7 = ttk.Button(centerFrame,text='下中上')
btn7.pack(expand=True,fill='both',padx=5,pady=5,ipady=20)
btn8 = ttk.Button(centerFrame,text='下中中')
btn8.pack(expand=True,fill='both',padx=5,ipady=5)
btn9 = ttk.Button(centerFrame,text='下中下')
btn9.pack(expand=True,fill='both',padx=5,pady=5,ipady=20)
centerFrame.pack(side='left',pady=10,expand=True,fill='both')
#end centerFrame========================================================================
#rightFrame============================================================================
rightFrame = ttk.Frame(bottomFrame,borderwidth=1,relief='groove',style='bottom.TFrame')
btn10 = ttk.Button(rightFrame,text='下右上')
btn10.pack(expand=True,fill='both',padx=5,pady=5)
btn11 = ttk.Button(rightFrame,text='下右中')
btn11.pack(expand=True,fill='both',padx=5)
btn12 = ttk.Button(rightFrame,text='下右下')
btn12.pack(expand=True,fill='both',padx=5,pady=5)
rightFrame.pack(side='left',padx=10,pady=10,expand=True,fill='both')
#end rightFrame========================================================================
bottomFrame.pack(padx=10,pady=10,expand=True,fill='both')
#endbottomFrame==================================================================
def main():
window = Window(theme='breeze')
window.mainloop()
if __name__ == '__main__':
main()