Python Slider
from tkinter import*
import tkinter.messagebox as tmsg
root=Tk()
root.title("My Slider")
root.geometry("750x450")
# myslider=Scale(root, from_=0, to=450)
# myslider.pack()
def getdollor():
print (f"We have credit {myslider2.get()} $ in your account")
tmsg.showinfo("Amount Credited!", f"We have credited {myslider2.get()} $ in your account.")
f=open("file3.txt", "w")
a=f.write(f"{myslider2.get()} $ credited in your account.\n")
with open("file3.txt", "a") as f:
f.write(f"Thanks for giving rate us >>> {name_value.get()}")
Label(root,text="How many dolor do you want").pack()
myslider2=Scale(root, from_=0, to=450, orient=HORIZONTAL)
myslider2.set(0)
myslider2.pack()
Label(root,text="Please give us rate from 1 to 10").pack()
name_value=StringVar()
name_entry=Entry(root, textvariable=name_value).pack()
Button(root, text="Get dollors", command=getdollor, pady=5).pack()
Button(root, text="Close", command=quit).pack()
root.mainloop()
Comments