2020年12月20日星期日

How to increase decrease a button for a while in tkinter?

I am new here, and a beginner in (at) Python 3.x

I am trying to create in tkinter a Button or two, when I click on the 1st button for example a third or forth button will increase and decrease (using width 16 and 18) 10 times, and after 10 times it return to being a normal button. Without using a class.

Thank you for helping

Code:

from tkinter import *  import time  window1 = Tk()  window1.geometry("300x300")  btn1=Button(text="16",font=40,width=16)  btn1.pack()    # here i want to create a loop to flash the button 10 times  # i dont know wich way is better :  # to use time.sleep with for in range or use .after  # or use def with loops  #can i put line 14 and 13 together ?!  #why the first button in line 5 does not apear instantly !? why line17 affect   that so i put #?  btn1["width"]=18  btn1["text"]="18"  btn1.pack()  #time.sleep(1)  btn1["width"]=16  btn1["text"]="16"  btn1.pack()  window1.mainloop()  
https://stackoverflow.com/questions/65381128/how-to-increase-decrease-a-button-for-a-while-in-tkinter December 20, 2020 at 10:47PM

没有评论:

发表评论