Python Forum

Full Version: On the spot counter
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
(Nov-28-2019, 11:28 AM)Astrikor Wrote: [ -> ]cmd does work, but is clunky to run a file.
I would rather run from an IDE.
Any other ideas?

I wouldn't call running file from terminal a clunky way Smile

I suggest to try VS Code. To run a file in terminal just 'CTRL + <' (default setting of "command": "python.execInTerminal") while in editor.
Thanks Guys.

On second thoughts I will use a simple GUI like tkinter for this.

Thanks again

Astrikor
I'm thinking tkinter night be do the job, something like

from tkinter import *
import time
for i in range (15):
    Count = "Count : ",i
    window = Tk()
    lbl = Label(window, text=Count)
    lbl.grid(column=0, row=0)
    window.mainloop()
    time.sleep(1)
Trying to overwrite the window label ?
Unfortunately my tkinter code does not update the count automatically.
Can anyone advise?

Many thanks
Astrikor

Finally cracked it.
from tkinter import *
import time

root = Tk()
var = StringVar()
var.set('')
Label(root, textvariable = var).pack()
for i in range(15):
    Count = "Count ",str(i)
    time.sleep(1)
    var.set(Count)
    root.update()
This works ok.

Thanks guys!
Astrikor
Pages: 1 2