Python Forum
[PyQt] label doesn't update on each iteration
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] label doesn't update on each iteration
#1
Hi all,
  I'm not new to programming, but I am new to Python.
  Can someone tell me why the label (lblTest) in my form (PyQt) doesn't update on each iteration? It only updates finally when the loop is complete.
  I've tried using ui.lblTest.update() and ui.lblTest.hide() and ui.lblTest.show() on each iteration (as I've seen suggested elsewhere), but it doesn't work.
def btnTest_clicked():
    x = 0
    while x < 4:
        print("Test: " + str(x))
        ui.lblTest.setText("Test: " + str(x))
        x = x + 1
        time.sleep(1.0)
Thanks,
David
Reply


Messages In This Thread
label doesn't update on each iteration - by daa - Dec-11-2016, 01:35 AM
RE: label doesn't update on each iteration - by daa - Dec-11-2016, 04:07 AM
RE: label doesn't update on each iteration - by daa - Dec-11-2016, 05:41 AM
RE: label doesn't update on each iteration - by daa - Dec-12-2016, 06:26 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] Update label if there are no records in treeview TomasSanchexx 1 976 Aug-20-2023, 04:45 PM
Last Post: menator01
  [Tkinter] Can't update label in new tk window, object has no attribute tompranks 3 3,601 Aug-30-2022, 08:44 AM
Last Post: tompranks
  update text variable on label with keypress knoxvilles_joker 3 4,975 Apr-17-2021, 11:21 PM
Last Post: knoxvilles_joker
  [Tkinter] how to update label text from list Roshan 8 5,507 Apr-25-2020, 08:04 AM
Last Post: Roshan
  Update a label text from subprocess jim53 3 4,387 Aug-19-2019, 08:21 PM
Last Post: Denni
  Unable to update or refresh label text in tkinter jenkins43 3 6,666 Jul-24-2019, 02:09 PM
Last Post: Friend
  Display and update the label text which display the serial value jenkins43 5 9,138 Feb-04-2019, 04:36 AM
Last Post: Larz60+
  [Tkinter] can't update label to include variable foxtreat 2 3,687 Dec-01-2018, 07:16 AM
Last Post: jfong
  [Tkinter] Label doesn't refresh jollydragon 7 7,029 Jul-13-2018, 05:55 AM
Last Post: jollydragon
  Update Gtk.Label in for-loop TimeMen 3 6,036 Jun-07-2018, 10:33 PM
Last Post: killerrex

Forum Jump:

User Panel Messages

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