Updating progress bar from external script
I'm trying to update a PyQt4 progress bar live from an external python script as that external script runs through its loops. I've provided a minimal, working example of my progress so far; can anyone please guide me on best practices going forward?
GUI.py:
import sys, os
from pyface.qt import QtGui, QtCore
os.environ['ETS_TOOLKIT'] = 'qt4'
from traits.api import HasTraits,Instance,on_trait_change,Int
from traitsui.api import View,Item,VGroup
import external
#from PyQt4.QtCore import QThread
class P1(QtGui.QWidget):
def __init__(self, parent=None):
super(P1, self).__init__(parent)
layout = QtGui.QGridLayout(self)
def setProgress():
if P1.progress.value() == 0:
self.button.setDisabled(True)
self.button.setText('Computing Data')
external.op()
if P1.progress.value() == 100:
self.button_dist.setText('Data Complete')
self.button = QtGui.QPushButton('Compute Data', self)
self.connect(self.button, QtCore.SIGNAL('clicked()'), setProgress)
layout.addWidget(self.button, 1, 2, 1, 1)
self.button.setDisabled(False)
self.button.show()
P1.progress = QtGui.QProgressBar(self)
P1.progress.setMinimum = 0
P1.progress.setMaximum = 100
P1.progress.setValue(0)
layout.addWidget(P1.progress, 1, 3, 1, 3)
P1.progress.show()
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.window = P1(self)
self.setCentralWidget(self.window)
self.show()
if __name__ == '__main__':
app = QtGui.QApplication.instance()
w = MainWindow()
sys.exit(app.exec_())
external.py:
import sys, os, time
from pyface.qt import QtGui, QtCore
os.environ['ETS_TOOLKIT'] = 'qt4'
from GUI import P1
#from PyQt4.QtCore import QThread
def op():
for i in range(1, 101):
p1 = P1()
p1.progress.setValue(i)
time.sleep(0.01)
print(i)
For this example to work as I intend, when you click the button Compute Data
, the progress bar should fill in at the same rate that i in range(1,101)
is printed in terminal.
python multithreading pyqt progress-bar
add a comment |
I'm trying to update a PyQt4 progress bar live from an external python script as that external script runs through its loops. I've provided a minimal, working example of my progress so far; can anyone please guide me on best practices going forward?
GUI.py:
import sys, os
from pyface.qt import QtGui, QtCore
os.environ['ETS_TOOLKIT'] = 'qt4'
from traits.api import HasTraits,Instance,on_trait_change,Int
from traitsui.api import View,Item,VGroup
import external
#from PyQt4.QtCore import QThread
class P1(QtGui.QWidget):
def __init__(self, parent=None):
super(P1, self).__init__(parent)
layout = QtGui.QGridLayout(self)
def setProgress():
if P1.progress.value() == 0:
self.button.setDisabled(True)
self.button.setText('Computing Data')
external.op()
if P1.progress.value() == 100:
self.button_dist.setText('Data Complete')
self.button = QtGui.QPushButton('Compute Data', self)
self.connect(self.button, QtCore.SIGNAL('clicked()'), setProgress)
layout.addWidget(self.button, 1, 2, 1, 1)
self.button.setDisabled(False)
self.button.show()
P1.progress = QtGui.QProgressBar(self)
P1.progress.setMinimum = 0
P1.progress.setMaximum = 100
P1.progress.setValue(0)
layout.addWidget(P1.progress, 1, 3, 1, 3)
P1.progress.show()
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.window = P1(self)
self.setCentralWidget(self.window)
self.show()
if __name__ == '__main__':
app = QtGui.QApplication.instance()
w = MainWindow()
sys.exit(app.exec_())
external.py:
import sys, os, time
from pyface.qt import QtGui, QtCore
os.environ['ETS_TOOLKIT'] = 'qt4'
from GUI import P1
#from PyQt4.QtCore import QThread
def op():
for i in range(1, 101):
p1 = P1()
p1.progress.setValue(i)
time.sleep(0.01)
print(i)
For this example to work as I intend, when you click the button Compute Data
, the progress bar should fill in at the same rate that i in range(1,101)
is printed in terminal.
python multithreading pyqt progress-bar
External script usually refers to a separate program run as a separate process. But you just want to access the progress bar from an other module run in the same process, don't you?
– Klaus D.
Nov 21 '18 at 3:47
@KlausD. well, I'm not actually sure. This is an example to help me solve my real problem where a GUI calls another script that then updates the GUI's progress bar live as that external script loops.
– ees
Nov 21 '18 at 3:56
For your 'real problem' you can import the other script, and when you run functions or whatever from it, pass a reference to the GUI object with the progress bar to it as a parameter. Then the code in the other script can update it directly.
– Simon Hibbs
Nov 21 '18 at 10:30
add a comment |
I'm trying to update a PyQt4 progress bar live from an external python script as that external script runs through its loops. I've provided a minimal, working example of my progress so far; can anyone please guide me on best practices going forward?
GUI.py:
import sys, os
from pyface.qt import QtGui, QtCore
os.environ['ETS_TOOLKIT'] = 'qt4'
from traits.api import HasTraits,Instance,on_trait_change,Int
from traitsui.api import View,Item,VGroup
import external
#from PyQt4.QtCore import QThread
class P1(QtGui.QWidget):
def __init__(self, parent=None):
super(P1, self).__init__(parent)
layout = QtGui.QGridLayout(self)
def setProgress():
if P1.progress.value() == 0:
self.button.setDisabled(True)
self.button.setText('Computing Data')
external.op()
if P1.progress.value() == 100:
self.button_dist.setText('Data Complete')
self.button = QtGui.QPushButton('Compute Data', self)
self.connect(self.button, QtCore.SIGNAL('clicked()'), setProgress)
layout.addWidget(self.button, 1, 2, 1, 1)
self.button.setDisabled(False)
self.button.show()
P1.progress = QtGui.QProgressBar(self)
P1.progress.setMinimum = 0
P1.progress.setMaximum = 100
P1.progress.setValue(0)
layout.addWidget(P1.progress, 1, 3, 1, 3)
P1.progress.show()
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.window = P1(self)
self.setCentralWidget(self.window)
self.show()
if __name__ == '__main__':
app = QtGui.QApplication.instance()
w = MainWindow()
sys.exit(app.exec_())
external.py:
import sys, os, time
from pyface.qt import QtGui, QtCore
os.environ['ETS_TOOLKIT'] = 'qt4'
from GUI import P1
#from PyQt4.QtCore import QThread
def op():
for i in range(1, 101):
p1 = P1()
p1.progress.setValue(i)
time.sleep(0.01)
print(i)
For this example to work as I intend, when you click the button Compute Data
, the progress bar should fill in at the same rate that i in range(1,101)
is printed in terminal.
python multithreading pyqt progress-bar
I'm trying to update a PyQt4 progress bar live from an external python script as that external script runs through its loops. I've provided a minimal, working example of my progress so far; can anyone please guide me on best practices going forward?
GUI.py:
import sys, os
from pyface.qt import QtGui, QtCore
os.environ['ETS_TOOLKIT'] = 'qt4'
from traits.api import HasTraits,Instance,on_trait_change,Int
from traitsui.api import View,Item,VGroup
import external
#from PyQt4.QtCore import QThread
class P1(QtGui.QWidget):
def __init__(self, parent=None):
super(P1, self).__init__(parent)
layout = QtGui.QGridLayout(self)
def setProgress():
if P1.progress.value() == 0:
self.button.setDisabled(True)
self.button.setText('Computing Data')
external.op()
if P1.progress.value() == 100:
self.button_dist.setText('Data Complete')
self.button = QtGui.QPushButton('Compute Data', self)
self.connect(self.button, QtCore.SIGNAL('clicked()'), setProgress)
layout.addWidget(self.button, 1, 2, 1, 1)
self.button.setDisabled(False)
self.button.show()
P1.progress = QtGui.QProgressBar(self)
P1.progress.setMinimum = 0
P1.progress.setMaximum = 100
P1.progress.setValue(0)
layout.addWidget(P1.progress, 1, 3, 1, 3)
P1.progress.show()
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.window = P1(self)
self.setCentralWidget(self.window)
self.show()
if __name__ == '__main__':
app = QtGui.QApplication.instance()
w = MainWindow()
sys.exit(app.exec_())
external.py:
import sys, os, time
from pyface.qt import QtGui, QtCore
os.environ['ETS_TOOLKIT'] = 'qt4'
from GUI import P1
#from PyQt4.QtCore import QThread
def op():
for i in range(1, 101):
p1 = P1()
p1.progress.setValue(i)
time.sleep(0.01)
print(i)
For this example to work as I intend, when you click the button Compute Data
, the progress bar should fill in at the same rate that i in range(1,101)
is printed in terminal.
python multithreading pyqt progress-bar
python multithreading pyqt progress-bar
edited Nov 21 '18 at 3:57
ees
asked Nov 21 '18 at 3:29
eesees
508
508
External script usually refers to a separate program run as a separate process. But you just want to access the progress bar from an other module run in the same process, don't you?
– Klaus D.
Nov 21 '18 at 3:47
@KlausD. well, I'm not actually sure. This is an example to help me solve my real problem where a GUI calls another script that then updates the GUI's progress bar live as that external script loops.
– ees
Nov 21 '18 at 3:56
For your 'real problem' you can import the other script, and when you run functions or whatever from it, pass a reference to the GUI object with the progress bar to it as a parameter. Then the code in the other script can update it directly.
– Simon Hibbs
Nov 21 '18 at 10:30
add a comment |
External script usually refers to a separate program run as a separate process. But you just want to access the progress bar from an other module run in the same process, don't you?
– Klaus D.
Nov 21 '18 at 3:47
@KlausD. well, I'm not actually sure. This is an example to help me solve my real problem where a GUI calls another script that then updates the GUI's progress bar live as that external script loops.
– ees
Nov 21 '18 at 3:56
For your 'real problem' you can import the other script, and when you run functions or whatever from it, pass a reference to the GUI object with the progress bar to it as a parameter. Then the code in the other script can update it directly.
– Simon Hibbs
Nov 21 '18 at 10:30
External script usually refers to a separate program run as a separate process. But you just want to access the progress bar from an other module run in the same process, don't you?
– Klaus D.
Nov 21 '18 at 3:47
External script usually refers to a separate program run as a separate process. But you just want to access the progress bar from an other module run in the same process, don't you?
– Klaus D.
Nov 21 '18 at 3:47
@KlausD. well, I'm not actually sure. This is an example to help me solve my real problem where a GUI calls another script that then updates the GUI's progress bar live as that external script loops.
– ees
Nov 21 '18 at 3:56
@KlausD. well, I'm not actually sure. This is an example to help me solve my real problem where a GUI calls another script that then updates the GUI's progress bar live as that external script loops.
– ees
Nov 21 '18 at 3:56
For your 'real problem' you can import the other script, and when you run functions or whatever from it, pass a reference to the GUI object with the progress bar to it as a parameter. Then the code in the other script can update it directly.
– Simon Hibbs
Nov 21 '18 at 10:30
For your 'real problem' you can import the other script, and when you run functions or whatever from it, pass a reference to the GUI object with the progress bar to it as a parameter. Then the code in the other script can update it directly.
– Simon Hibbs
Nov 21 '18 at 10:30
add a comment |
1 Answer
1
active
oldest
votes
You have a circular import that causes an infinite loop since GUI imports to external and external to GUI, that is a symptom of a bad design. On the other hand the progressbar must be a member of the class. In addition, the external task must be executed in a thread and to update them you must use a signal that will transport the data to the GUI thread.
external.py
import sys, os, time
from pyface.qt import QtGui, QtCore
os.environ['ETS_TOOLKIT'] = 'qt4'
def op(progress):
for i in range(1, 101):
progress.emit(i)
time.sleep(0.01)
print(i)
GUI.py
import sys, os
from pyface.qt import QtGui, QtCore
os.environ['ETS_TOOLKIT'] = 'qt4'
import threading
# from traits.api import HasTraits,Instance,on_trait_change,Int
# from traitsui.api import View,Item,VGroup
import external
class P1(QtGui.QWidget):
progressChanged = QtCore.Signal(int)
def __init__(self, parent=None):
super(P1, self).__init__(parent)
self.button = QtGui.QPushButton('Compute Data')
self.button.clicked.connect(self.start_task)
self.progress = QtGui.QProgressBar(minimum=0, maximum=100, value=0)
self.progressChanged.connect(self.on_progressChanged)
layout = QtGui.QGridLayout(self)
layout.addWidget(self.button, 1, 2, 1, 1)
layout.addWidget(self.progress, 1, 3, 1, 3)
@QtCore.Slot()
def start_task(self):
t = threading.Thread(target=external.op, args=(self.progressChanged, ), daemon=True)
t.start()
@QtCore.Slot(int)
def on_progressChanged(self, val):
self.progress.setValue(val)
if val == self.progress.maximum():
self.button.setDisabled(False)
self.button.setText('Data Complete')
else:
self.button.setText('Computing Data')
self.button.setDisabled(True)
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.window = P1()
self.setCentralWidget(self.window)
self.show()
if __name__ == '__main__':
app = QtGui.QApplication.instance()
if app is None:
app = QtGui.QApplication()
w = MainWindow()
sys.exit(app.exec_())
absolutely perfect! thank you so much yet again!!
– ees
Nov 21 '18 at 14:35
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404863%2fupdating-progress-bar-from-external-script%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You have a circular import that causes an infinite loop since GUI imports to external and external to GUI, that is a symptom of a bad design. On the other hand the progressbar must be a member of the class. In addition, the external task must be executed in a thread and to update them you must use a signal that will transport the data to the GUI thread.
external.py
import sys, os, time
from pyface.qt import QtGui, QtCore
os.environ['ETS_TOOLKIT'] = 'qt4'
def op(progress):
for i in range(1, 101):
progress.emit(i)
time.sleep(0.01)
print(i)
GUI.py
import sys, os
from pyface.qt import QtGui, QtCore
os.environ['ETS_TOOLKIT'] = 'qt4'
import threading
# from traits.api import HasTraits,Instance,on_trait_change,Int
# from traitsui.api import View,Item,VGroup
import external
class P1(QtGui.QWidget):
progressChanged = QtCore.Signal(int)
def __init__(self, parent=None):
super(P1, self).__init__(parent)
self.button = QtGui.QPushButton('Compute Data')
self.button.clicked.connect(self.start_task)
self.progress = QtGui.QProgressBar(minimum=0, maximum=100, value=0)
self.progressChanged.connect(self.on_progressChanged)
layout = QtGui.QGridLayout(self)
layout.addWidget(self.button, 1, 2, 1, 1)
layout.addWidget(self.progress, 1, 3, 1, 3)
@QtCore.Slot()
def start_task(self):
t = threading.Thread(target=external.op, args=(self.progressChanged, ), daemon=True)
t.start()
@QtCore.Slot(int)
def on_progressChanged(self, val):
self.progress.setValue(val)
if val == self.progress.maximum():
self.button.setDisabled(False)
self.button.setText('Data Complete')
else:
self.button.setText('Computing Data')
self.button.setDisabled(True)
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.window = P1()
self.setCentralWidget(self.window)
self.show()
if __name__ == '__main__':
app = QtGui.QApplication.instance()
if app is None:
app = QtGui.QApplication()
w = MainWindow()
sys.exit(app.exec_())
absolutely perfect! thank you so much yet again!!
– ees
Nov 21 '18 at 14:35
add a comment |
You have a circular import that causes an infinite loop since GUI imports to external and external to GUI, that is a symptom of a bad design. On the other hand the progressbar must be a member of the class. In addition, the external task must be executed in a thread and to update them you must use a signal that will transport the data to the GUI thread.
external.py
import sys, os, time
from pyface.qt import QtGui, QtCore
os.environ['ETS_TOOLKIT'] = 'qt4'
def op(progress):
for i in range(1, 101):
progress.emit(i)
time.sleep(0.01)
print(i)
GUI.py
import sys, os
from pyface.qt import QtGui, QtCore
os.environ['ETS_TOOLKIT'] = 'qt4'
import threading
# from traits.api import HasTraits,Instance,on_trait_change,Int
# from traitsui.api import View,Item,VGroup
import external
class P1(QtGui.QWidget):
progressChanged = QtCore.Signal(int)
def __init__(self, parent=None):
super(P1, self).__init__(parent)
self.button = QtGui.QPushButton('Compute Data')
self.button.clicked.connect(self.start_task)
self.progress = QtGui.QProgressBar(minimum=0, maximum=100, value=0)
self.progressChanged.connect(self.on_progressChanged)
layout = QtGui.QGridLayout(self)
layout.addWidget(self.button, 1, 2, 1, 1)
layout.addWidget(self.progress, 1, 3, 1, 3)
@QtCore.Slot()
def start_task(self):
t = threading.Thread(target=external.op, args=(self.progressChanged, ), daemon=True)
t.start()
@QtCore.Slot(int)
def on_progressChanged(self, val):
self.progress.setValue(val)
if val == self.progress.maximum():
self.button.setDisabled(False)
self.button.setText('Data Complete')
else:
self.button.setText('Computing Data')
self.button.setDisabled(True)
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.window = P1()
self.setCentralWidget(self.window)
self.show()
if __name__ == '__main__':
app = QtGui.QApplication.instance()
if app is None:
app = QtGui.QApplication()
w = MainWindow()
sys.exit(app.exec_())
absolutely perfect! thank you so much yet again!!
– ees
Nov 21 '18 at 14:35
add a comment |
You have a circular import that causes an infinite loop since GUI imports to external and external to GUI, that is a symptom of a bad design. On the other hand the progressbar must be a member of the class. In addition, the external task must be executed in a thread and to update them you must use a signal that will transport the data to the GUI thread.
external.py
import sys, os, time
from pyface.qt import QtGui, QtCore
os.environ['ETS_TOOLKIT'] = 'qt4'
def op(progress):
for i in range(1, 101):
progress.emit(i)
time.sleep(0.01)
print(i)
GUI.py
import sys, os
from pyface.qt import QtGui, QtCore
os.environ['ETS_TOOLKIT'] = 'qt4'
import threading
# from traits.api import HasTraits,Instance,on_trait_change,Int
# from traitsui.api import View,Item,VGroup
import external
class P1(QtGui.QWidget):
progressChanged = QtCore.Signal(int)
def __init__(self, parent=None):
super(P1, self).__init__(parent)
self.button = QtGui.QPushButton('Compute Data')
self.button.clicked.connect(self.start_task)
self.progress = QtGui.QProgressBar(minimum=0, maximum=100, value=0)
self.progressChanged.connect(self.on_progressChanged)
layout = QtGui.QGridLayout(self)
layout.addWidget(self.button, 1, 2, 1, 1)
layout.addWidget(self.progress, 1, 3, 1, 3)
@QtCore.Slot()
def start_task(self):
t = threading.Thread(target=external.op, args=(self.progressChanged, ), daemon=True)
t.start()
@QtCore.Slot(int)
def on_progressChanged(self, val):
self.progress.setValue(val)
if val == self.progress.maximum():
self.button.setDisabled(False)
self.button.setText('Data Complete')
else:
self.button.setText('Computing Data')
self.button.setDisabled(True)
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.window = P1()
self.setCentralWidget(self.window)
self.show()
if __name__ == '__main__':
app = QtGui.QApplication.instance()
if app is None:
app = QtGui.QApplication()
w = MainWindow()
sys.exit(app.exec_())
You have a circular import that causes an infinite loop since GUI imports to external and external to GUI, that is a symptom of a bad design. On the other hand the progressbar must be a member of the class. In addition, the external task must be executed in a thread and to update them you must use a signal that will transport the data to the GUI thread.
external.py
import sys, os, time
from pyface.qt import QtGui, QtCore
os.environ['ETS_TOOLKIT'] = 'qt4'
def op(progress):
for i in range(1, 101):
progress.emit(i)
time.sleep(0.01)
print(i)
GUI.py
import sys, os
from pyface.qt import QtGui, QtCore
os.environ['ETS_TOOLKIT'] = 'qt4'
import threading
# from traits.api import HasTraits,Instance,on_trait_change,Int
# from traitsui.api import View,Item,VGroup
import external
class P1(QtGui.QWidget):
progressChanged = QtCore.Signal(int)
def __init__(self, parent=None):
super(P1, self).__init__(parent)
self.button = QtGui.QPushButton('Compute Data')
self.button.clicked.connect(self.start_task)
self.progress = QtGui.QProgressBar(minimum=0, maximum=100, value=0)
self.progressChanged.connect(self.on_progressChanged)
layout = QtGui.QGridLayout(self)
layout.addWidget(self.button, 1, 2, 1, 1)
layout.addWidget(self.progress, 1, 3, 1, 3)
@QtCore.Slot()
def start_task(self):
t = threading.Thread(target=external.op, args=(self.progressChanged, ), daemon=True)
t.start()
@QtCore.Slot(int)
def on_progressChanged(self, val):
self.progress.setValue(val)
if val == self.progress.maximum():
self.button.setDisabled(False)
self.button.setText('Data Complete')
else:
self.button.setText('Computing Data')
self.button.setDisabled(True)
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.window = P1()
self.setCentralWidget(self.window)
self.show()
if __name__ == '__main__':
app = QtGui.QApplication.instance()
if app is None:
app = QtGui.QApplication()
w = MainWindow()
sys.exit(app.exec_())
answered Nov 21 '18 at 7:48
eyllanesceyllanesc
80.7k103258
80.7k103258
absolutely perfect! thank you so much yet again!!
– ees
Nov 21 '18 at 14:35
add a comment |
absolutely perfect! thank you so much yet again!!
– ees
Nov 21 '18 at 14:35
absolutely perfect! thank you so much yet again!!
– ees
Nov 21 '18 at 14:35
absolutely perfect! thank you so much yet again!!
– ees
Nov 21 '18 at 14:35
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404863%2fupdating-progress-bar-from-external-script%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
External script usually refers to a separate program run as a separate process. But you just want to access the progress bar from an other module run in the same process, don't you?
– Klaus D.
Nov 21 '18 at 3:47
@KlausD. well, I'm not actually sure. This is an example to help me solve my real problem where a GUI calls another script that then updates the GUI's progress bar live as that external script loops.
– ees
Nov 21 '18 at 3:56
For your 'real problem' you can import the other script, and when you run functions or whatever from it, pass a reference to the GUI object with the progress bar to it as a parameter. Then the code in the other script can update it directly.
– Simon Hibbs
Nov 21 '18 at 10:30