Functions acting strange when run as thread in Kivy/Python -
i building app that, when user hits 'run' button, generates table of buttons.
because process takes while, want add popup or progress bar alert user function running , not frozen. decided create popup , call function using threading screen updated when function starts (as opposed once done).
mythread = threading.thread(target=run_function) mythread.start()
the trouble when call function above code works strangely: columns of table wrong width, of buttons arbitrarily empty, , others have wrong fill color. fix this, need remove threading operation , call run_function()
any idea why happening?
i new python, dumb mistake, have no idea. different between process running thread , default operation?
disclaimer: haven't worked kivy.
not every framework works multithreading.
but of gui frameworks have event loop responsible managing user events (mouse clicks, keyboard) , queued drawing operations (widgets).
in case if don't want ui freezed, should regularly give control framework's event loop.
i guess kivy.base.eventloopbase.dispatch_input
need call show added widget or handle user events.
Comments
Post a Comment