Python Forum
Update a label text from subprocess
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Update a label text from subprocess
#4
Okay but you are executing a linear thread which means nothing after this

process = Popen(command, stdout=PIPE, shell=True)
gets executed until it completes as per the documentation on subprocess:
  • Run the command described by args. Wait for command to complete, then return the returncode attribute.
found here ( https://docs.python.org/2/library/subprocess.html ) and I highly doubt that Wait is a Sleeping Wait which means it blocks all other execution until it is done
---
So in order for you to have dual processing as you seem to be wanting you will have to fire off a second process using Multiprocessing because a Thread, due to GIL, does basically the same thing as Subprocess -- although there are tricks to get a Thread to allow the OS to do something else prior to completing and perhaps the Subprocess can as well but I without looking more closely into this I cannot say for sure. Note I did look into this previously (a while back) for what I am doing and ended up using a combination of Threads and Multiprocessing as if I recall correctly the Subprocess basically works sort of like a Thread due to python's GIL restrictions but did not have the flexibility that a Thread provided me
Reply


Messages In This Thread
Update a label text from subprocess - by jim53 - Aug-18-2019, 08:47 AM
RE: Update a label text from subprocess - by jim53 - Aug-18-2019, 10:14 AM
RE: Update a label text from subprocess - by Denni - Aug-19-2019, 08:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] Update label if there are no records in treeview TomasSanchexx 1 944 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,557 Aug-30-2022, 08:44 AM
Last Post: tompranks
  [Tkinter] The Text in the Label widget Tkinter cuts off the Long text in the view malmustafa 4 4,898 Jun-26-2022, 06:26 PM
Last Post: menator01
  [Tkinter] Make my button text update? Skata100 1 2,039 Aug-07-2021, 05:37 AM
Last Post: deanhystad
  update text variable on label with keypress knoxvilles_joker 3 4,924 Apr-17-2021, 11:21 PM
Last Post: knoxvilles_joker
  How to read text in kivy textinput or Label jadel440 1 5,263 Dec-29-2020, 10:47 AM
Last Post: joe_momma
  [Kivy] Kivy text label won't shows up! AVD_01 1 2,941 Jun-21-2020, 04:01 PM
Last Post: AVD_01
  [Tkinter] Python 3 change label text gw1500se 6 4,713 May-08-2020, 05:47 PM
Last Post: deanhystad
  [Tkinter] how to update label text from list Roshan 8 5,459 Apr-25-2020, 08:04 AM
Last Post: Roshan
  [PyQt] Python PyQt5 - Change label text dynamically based on user Input ppel123 1 13,780 Mar-20-2020, 07:21 AM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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