ColoradoSchoolOfMines / visplay

A libmpv and Qt based application for automating and controlling media playback on any display.
https://coloradoschoolofmines.github.io/visplay/
GNU General Public License v3.0
4 stars 1 forks source link

Thread Initailization Error #16

Open Warfields opened 6 years ago

Warfields commented 6 years ago

The below code won't work because qt needs time to setup

import libvisplaygui
from threading import Thread

new_thread = Thread(target=libvisplaygui.init_gui)
new_thread.setDaemon(True)
new_thread.start()

libvisplaygui.open_media("https://www.youtube.com/watch?v=RtWbpyjJqrU")

Current Bodge

import libvisplaygui
from threading import Thread
from time import sleep

new_thread = Thread(target=libvisplaygui.init_gui)
new_thread.setDaemon(True)
new_thread.start()

sleep(1)
libvisplaygui.open_media("https://www.youtube.com/watch?v=RtWbpyjJqrU")
jackrosenthal commented 6 years ago

Don't use setDaemon btw... this is from the Python 1.x days...

See here: https://docs.python.org/3/library/threading.html#threading.Thread.setDaemon

robozman commented 6 years ago

Working on a fix for this. Going to likely need to do some pthreads magic