From ffa93609a41fef98b3b34742642a4c8f4eaa7fbe Mon Sep 17 00:00:00 2001 From: Satyam Date: Sun, 3 Oct 2021 21:10:53 +0530 Subject: [PATCH] Added a styled Button in examples/buttons --- examples/buttons/button-styled.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 examples/buttons/button-styled.py diff --git a/examples/buttons/button-styled.py b/examples/buttons/button-styled.py new file mode 100644 index 0000000..9e74727 --- /dev/null +++ b/examples/buttons/button-styled.py @@ -0,0 +1,23 @@ +from tkinter import Tk, Button #importing Tk and button from tkinter +from tkinter import ttk #importing ttk from tkinter that is used to style the tkinter widgets + +'''initilaizing tkinter window''' +root=Tk() + +'''Adding Normal Button ''' +btn1 = Button(root, text = 'Normal Button') +btn1.pack(pady=20) #pady means padding along y axis + +'''#Adding Styled Button''' +style=ttk.Style() #importing Style class from Ttk +style.configure('TButton', font =('@Adobe Kaiti Std R', 10, 'italic', ),foreground="black",background="Green", )#configuring styles in Button + +#adding the made style in Button +btn2=ttk.Button(root, text="Styled Button",style ='TButton') +btn2.pack(pady=20) + +'''Notice +style option inside styled button comes only with ttk not with the normal Tk button + +''' +root.mainloop() \ No newline at end of file