Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
On the spot counter
#11
(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.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply
#12
Thanks Guys.

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

Thanks again

Astrikor
Reply
#13
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 ?
Reply
#14
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
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020