Threading failed using Tkinter and Python 2.7
I cant solve this. I've been searching for few days but still cant fix it yet.
nasrul@nasrul-Lenovo:~/Documents/HBRMonitorV1.00$ python main.py
VIDEOIO ERROR: V4L: index 1 is not correct!
OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /tmp/binarydeb/ros-kinetic-opencv3-3.3.1/modules/imgproc/src/color.cpp, line 11048
Traceback (most recent call last):
File "main.py", line 35, in <module>
guiThread.start(videoThread)
File "/home/nasrul/Documents/HBRMonitorV1.00/gui.py", line 39, in start
self.main_window = MainWindow(self, self.cameraThread, self.root)
File "/home/nasrul/Documents/HBRMonitorV1.00/gui.py", line 87, in __init__
self.signal_display = WindowSignal(self, root, gui_thread, video_thread, self.statusbar, self.video_display)
File "/home/nasrul/Documents/HBRMonitorV1.00/gui_windowSignal.py", line 34, in __init__
self.__create_gui()
File "/home/nasrul/Documents/HBRMonitorV1.00/gui_windowSignal.py", line 64, in __create_gui
self.video_display, self.dataQueue)
File "/home/nasrul/Documents/HBRMonitorV1.00/gui_signalProcessor.py", line 47, in __init__
self.signalProcessingInstance = SignalProcessor()
File "/home/nasrul/Documents/HBRMonitorV1.00/signal_processing.py", line 34, in __init__
self.serial_interface = serial_interface.SerialInterface('/dev/ttyUSB0')
File "/home/nasrul/Documents/HBRMonitorV1.00/serial_interface.py", line 33, in __init__
self.serial_connection = serial.Serial(self.vPort, 9600)
File "/usr/lib/python2.7/dist-packages/serial/serialutil.py", line 180, in __init__
self.open()
File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 311, in open
self._update_dtr_state()
File "/usr/lib/python2.7/dist-packages/serial/serialposix.py", line 605, in _update_dtr_state
fcntl.ioctl(self.fd, TIOCMBIS, TIOCM_DTR_str)
IOError: [Errno 22] Invalid argument
Exception in thread Thread-3:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/nasrul/Documents/HBRMonitorV1.00/gui_toolbarROI.py", line 262, in __store_roi
if len(self.textbox_x1.get("1.0", Tk.END + "-1c")) > 0 & (
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 3082, in get
return self.tk.call(self._w, 'get', index1, index2)
RuntimeError: main thread is not in main loop
Exception in thread Thread-4:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/nasrul/Documents/HBRMonitorV1.00/gui_toolbarROI.py", line 247, in __store_color_channel
chan = self.list_color_channelsStr.get()
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 343, in get
value = self._tk.globalgetvar(self._name)
RuntimeError: main thread is not in main loop
Exception in thread Thread-6:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/nasrul/Documents/HBRMonitorV1.00/gui_windowVideo.py", line 195, in __compute_fps
self.video_frame.after(1000, lambda: self.__compute_fps())
File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 597, in after
name = self._register(callit)
File "/usr ...
i think u should check jpeg and png and V4L when building opencv
Thankyou. I've been wondering why it doesnt work. It's seems like my TKinter is the problem, cause the code was perfectly fine in another pc.
@arh24. The answer is NO!. That is not the problem jpeg. The
thread is not in mainloop
==> that is problem will be solved