Chuan Chudabut

I wrote a python3 script with Qtimer but i got a hang or not response gui.

When my script is take long running my gui is hang.

I try to run Qtimer in thread but get error

QObject::startTimer: Timers can only be used with threads started with QThread

Then I try my trick

  1. create a thread
  2. add thread to function
  3. then run the function in Qtimer

Example

def start_thread(func, name=None, args = []):
threading.Thread(target=func, name=name, args=args).start()

def check_process():
print(‘run check_process’)

def run_thread():
start_thread(check_process)

timer=QTimer()
timer.timeout.connect(run_thread)
timer.start(3000)

Hope this help, any error you can ask more on comment below

--

--

  1. Enable ssh port forwarding

ensure follwoing in /etc/ssh/sshd_config
GatewayPorts yes

2. disable shell access and allow only tunnel for your client ssh user

  • in /etc/passwd in yoursshuser, replace shell of tunnel from /bin/bash to /bin/false

3. client side conenction command

ssh -f -N -R 1008:127.0.0.1:80 yoursshuser@yoursshserver.com

--

--