Ubuntu python threading timer

2017-01-11  Source: Original Site  Category:Ubuntu  Views:193 

Advertisement

anyone programming in python?:) ..im a beginer

def hello():
print "hello"
t = threading.Timer(5.0, hello).start()

t = threading.Timer(5.0, hello)
t.start()

i would like to make a thread which will repeat every 5 sec.
i done that...but when i exit gui form the tread is still running
and every 5 sec i get the output and i have to pres ctrl+c to end the program in console

i know i have to cancel it...i did that..but not working i get the errors like "AttributeError: 'NoneType' object has no attribute 'cancel'"

how can i solve this?

btw im seeking for good python forum...if anyone knows one

Related articles
  • Ubuntu python threading timer 2017-01-11

    anyone programming in python?:) ..im a beginer def hello(): print "hello" t = threading.Timer(5.0, hello).start() t = threading.Timer(5.0, hello) t.start() i would like to make a thread which will repeat every 5 sec. i done that...but when i exi

  • Ubuntu Python: set time for user input 2012-11-25

    I am trying to get a piece of code going, in which the user has a set amount of time in which to enter some text. If they do not and the time expires or if they do before the time has expired it should move (instantly) on depending on whether anythin

  • Ubuntu python threading is not working in windows 2012-12-07

    Hai All, I have done a gui based program in Python + pygtk. when I run the program the database connection breaks repeatedly.Actually the db server is far away from the system running the program so I had to connect to it through network. In order to

  • Ubuntu Python one-time pad 2012-07-11

    Out of boredom, I created a one-time pad application to encrypt and decrypt printable messages. Click here (http://en.wikipedia.org/wiki/One-time_pad)for more information on one-time pads. It's a very easy encryption algorithm, and the decryption is

  • Ubuntu [PYTHON] Threading + turtle = crash! 2013-07-21

    i was wandering about runin more tham one prosses at a time and found a tutorial about a module name threading. I decided to test out what i learnt from it using the turtle module. http://i674.photobucket.com/albums/vv109/the-it/pythoncrash.jpg here

  • Ubuntu Python Threads Progress Bars Problem (generators?) 2013-10-25

    I'm developing a python app that restores portions of the OS depending on the specific computer model. I've never really rapped my head around progress bars so they're always a pain. Nonetheless, I'm using one thread to pulse the progress bar and ano

  • Ubuntu Python Threading Issues 2012-04-22

    I'm working on a program that stacks images using PIL. I made a GUI with wxPython. The operation is done in a thread so it doesn't lock up the GUI and allows the user to cancel the operation at any time. The problem I'm having is with the behaviour o

  • Ubuntu Python Threading 2012-05-21

    i am working on an applet for Cairo-Dock (working with the provided API). The applet must perform a repetitive task every minute while being available for callbacks. So i looked into threading for python and found this nice tutorial (http://en.wikibo

  • Ubuntu Python thread issue 2013-09-21

    i'm trying to write a small testing program since im quite new to python. The program: I connect a bluetooth device to my program using sockets. When connecting im opening 2 sockets (send & receive). The receive socket is used to receive data fro

  • Ubuntu Python - wait time problem 2014-08-08

    Hey, I've been working on a project for a while now. What it does is, it reads data from a website every five minutes, then updates itself. Thing is, I'm having a little trouble getting it to wait five minutes. This is what I have been using in pytho

  • Ubuntu Python Timer not going off 2012-02-23

    I am writing a alarm clock application w/ a gui using GTK. When a user makes a change to the gui it activates self.setAlarm which calls self.calcAlarm which calculates a dates based on what days are selected and what time the alarm on that day is set

  • Ubuntu Problem with Python Callback Timer Class 2012-03-28

    there, i'm receiving an error from python when i try to use a callback timer class i get the TypeError: 'module' object is not callable, The class is below along with the callback function it's supposed to call and the main function. ttimer class: cl

  • Ubuntu Simple thread consuming 100% of CPU time 2013-02-17

    Just yesterday I started learning about threading in Python. In an attempt to test out what I've been reading, I created a simple little pyGTK/Glade app that starts a thread when a button is clicked. I was having some problems with that, so I posted

  • Ubuntu [Python] Returning a value that is being run in a Thread 2013-08-24

    Hello, so heres a script ill use to help explain my problem ^^ Firstly, i have modified the Thread function of python, to give myself the ability to forcefully terminate a Thread; among other features. Thread.py import sys, trace, threading class Thr

  • Ubuntu Creating 32-bit Python run-time on 64-bit server? 2014-03-30

    Some server-side Python problems have huge memory usage. This is especially true for 64-bit platforms, since Python programs are all about references and objects and 64-bit effectively doubles reference size. Example: http://jstahl.org/archives/2010/

  • Ubuntu kdeinit starts 195 (!) python threads 2015-05-20

    Recently, applications would occassionally refuse to start. On the terminal there was some kind of error message about "too many connections" to the X server. So I looked at the processes and there were many many many python threads. 195 the last tim

  • Ubuntu Threaded timer 2012-06-09

    Can anyone tell what I'm doing wrong? import threading def timedActivation(): print "Activating in 5 seconds..." timer = threading.Timer(5.0, activation) timer.start() print "from now!" def activation(): print "5 seconds have passed" As I run the fun

  • Ubuntu [python] sys.settraceback used within threads 2013-02-13

    Hello, here is some sample code for which i am going to use for the basis of my question :) x.py import sys, linecache global FileName FileName = globals()['__file__'] def _trace(frame, event, arg): if event == "line": lineno = frame.f_lineno filenam

  • Ubuntu [Questions] how to detect the status of a python thread? 2014-09-25

    Could anyone kind enough to tell me how to determine the status of a python thread started by "thread.start_new_thread". How to tell whether the thread is still running or not Many

  • Ubuntu Python - No Beep 2012-08-20

    I have been trying to learn more python and have come across a problem getting a system beep. I did some searching and everything I have seen indicates that print '\a' will work. Can someone please assist? Below is my simple little script. It is a ti