text: from PyQt5 import QtCore, QtWidgets
  from PyQt5.QtGui import * 
  from wired_module import * 
  #import cv2
  from _thread import *
  #	Generated By WiredQT for Python: by Rocky Nuarin, 2021 Phils
  class Handler(QtWidgets.QWidget,usercontrol):
  	#WiredEvent def frameReady(frame)	
  	#WiredProperty 'Open': '',"list":["True","False"]
  	#WiredProperty 'camindex': '0'
  	def __init__(self,*param):    
  		super(Handler, self).__init__(None)
  		initUI(self,param,w=400,h=400,title="WiredQTv5.0",controlbox=True,startpos=(0,30),timeoutdestroy=-1)
  		self.GTKForms()
  		self.timer=QtCore.QTimer()
  		self.timer.timeout.connect(self.loop)
  		self.timer.start(5)       
  
  		self.sch=Scheduler(5)#500 ms
  		self.sch.Start()
  		self.video_capture=None
  		self.skipaquare=False
  		self._Open=""
  		self.ret=-1
  		self._camindex=0
  	@property
  	def camindex(self):
  		return self._camindex
  	@camindex.setter	
  	def camindex(self,value):
  		self._camindex=int(value)
  	@property
  	def Width(self):
  		return self.Image1.Width
  	@Width.setter	
  	def Width(self,value):
  		self.Image1.Width=value
  		self.setFixedWidth(int(value))
  	@property
  	def Height(self):
  		return self.Image1.Height
  	@Height.setter	
  	def Height(self,value):
  		self.Image1.Height=value
  		self.setFixedHeight(int(value))
  		
  	def connect(self,ev,evusr):
  		self.wiredevents.update({ev:evusr})
  	def activeXcreated(self,*args):
  		self.Image1.Width=self.Width
  		self.Image1.Height=self.Height
  		pass
  	def acquireFrame(self):
  		self.stop=False
  		while 1:
  			if self.skipaquare==False:
  				self.ret, self.frame = self.video_capture.read()
  			else:
  				delay(20)
  			if self.stop==True:
  				break
  		self.video_capture.release()
  		self.video_capture=None
  	def PauseAquireImage(self,flag):#True or False
  		self.skipaquare=flag
  	def imshow(self,cvImg):
  		self.Image1.LoadPictureOCV=cvImg
  	def unload(self,*args):
  		pass
  	@property
  	def Open(self):
  		return self._Open
  	@Open.setter	
  	def Open(self,value):
  		self._Open=value
  		if self.video_capture==None:
  			if value=='True' or value==True:
  				try:#skip cv2 while dev on QT
  					self.video_capture = cv2.VideoCapture(int(self._camindex))
  					start_new_thread(self.acquireFrame ,())
  				except:
  					pass
  		else:
  			self.stop=True
  	def loop(self):
  		if self.form_load==False:
  			self.form_load=True
  		if self.sch.Event():#timer routine
  			if self.video_capture!=None:
  				if self.ret!=-1:
  					if self.caller!=None and 'frameReady' in self.wiredevents:self.wiredevents['frameReady'](self.frame)
  			self.sch.Start()#restart scheduler
  		return True	#return true so that main_loop can call it again 	
  	def create(self,prop,control,parent,event=[]):
  		createWidget(self,prop,control,parent,event)
  	def GTKForms(self):
  		self.create("{'Text': 'Image1', 'Font': '', 'Enable': 'True', 'Height': '110', 'Events': '[[, ]]', 'ParentsType': '', 'Top': '0', 'Width': '155', 'Visible': 'True', 'Picture': '', 'ForeColor': '(0,0,0,1)', 'Tag': '', 'Left': '0', 'Name': 'Image1', 'Var': '', 'Help': '', 'BackColor': '(1,1,1,1)'}","QLabel","usercontrol","[]")
  	def Widget(self):
  		return self
  	
  	
  if __name__ == "__main__":
  	import sys
  	app = QtWidgets.QApplication(sys.argv)
  	w = Handler()
  	w.show()
  	sys.exit(app.exec_())
  