-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
36 lines (24 loc) · 783 Bytes
/
main.py
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
36
from tkinter import *
import tkinter.ttk as ttk
root = Tk()
root.geometry("500x550")
root.attributes('-alpha', 0.7)
my_label = Label(root, text="Hello World!", font=("Helvetica", 20))
my_label.pack(pady=20)
def slide(x):
root.attributes('-alpha', my_slider.get())
slide_label.config(text=str(round(my_slider.get(), 2)))
my_slider = ttk.Scale(root, from_=0.1, to=1.0, value=0.7, orient=HORIZONTAL, command=slide)
my_slider.pack(pady=20)
slide_label = Label(root, text='')
slide_label.pack(pady=10)
def make_solid(e):
new.attributes('-alpha', 1.0)
def new_window():
global new
new = Toplevel()
new.attributes('-alpha', 0.5)
new.bind("<Button-1>", make_solid)
new_window = Button(root, text="New Window", command=new_window)
new_window.pack(pady=20)
root.mainloop()