-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathentry_widget.py
More file actions
35 lines (25 loc) · 753 Bytes
/
entry_widget.py
File metadata and controls
35 lines (25 loc) · 753 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from tkinter import *
import ttkbootstrap as tb
root = tb.Window(themename="superhero")
#root = Tk()
root.title("TTK Bootstrap! Combobox")
root.iconbitmap('images/codemy.ico')
root.geometry('500x350')
# Create Entry Function
def speak():
my_label.config(text=f'You Typed: {my_entry.get()}')
# Create Entry Widget
# Colors: primary, secondary, success, info, warning, danger, light, dark
my_entry = tb.Entry(root, bootstyle="success",
font=("Helvetica", 18),
foreground="green",
width=15,
show="&")
my_entry.pack(pady=50)
# Create Button
my_button = tb.Button(root, bootstyle="danger outline", text="Click Me", command=speak)
my_button.pack(pady=20)
# Create Label
my_label = tb.Label(root, text="")
my_label.pack(pady=20)
root.mainloop()