|
|
2010-04-03
, 14:17
|
|
|
Posts: 385 |
Thanked: 344 times |
Joined on Jan 2010
@ Israel
|
#11
|
|
|
2010-04-03
, 14:22
|
|
|
Posts: 1,684 |
Thanked: 1,562 times |
Joined on Jun 2008
@ Austin, TX
|
#12
|
gtk.gdk.threads_init()
@contextlib.contextmanager def gtk_lock(): gtk.gdk.threads_enter() try: yield finally: gtk.gdk.threads_leave()
with gtk_lock(): # do stuff
def async(func): """ Make a function mainloop friendly. the function will be called at the next mainloop idle state. """ @functools.wraps(func) def new_function(*args, **kwargs): def async_function(): func(*args, **kwargs) return False gobject.idle_add(async_function) return new_function
| The Following 3 Users Say Thank You to epage For This Useful Post: | ||
|
|
2010-04-03
, 14:24
|
|
Posts: 308 |
Thanked: 62 times |
Joined on Jun 2009
@ Turkiye
|
#13
|
import pygtk
import gtk
import hildon
import gtk.glade
from bluetooth import *
import time,threading
class gui(threading.Thread):
def gon(self,data=None):
data=self.got.get_text()
print data
if len(data)!=0:
self.sock.send(data)
def __init__(self):
self.a=0
self.program = hildon.Program()
self.program.__init__()
self.window = hildon.Window()
self.program.add_window(self.window)
self.window.connect("destroy", gtk.main_quit)
self.glade_file = "sck.glade"
self.wTree = gtk.glade.XML(self.glade_file)
self.got = self.wTree.get_widget("entry1")
self.al = self.wTree.get_widget("entry2")
btn = self.wTree.get_widget("button1")
signals={'clicked':self.send}
self.wTree.signal_autoconnect(signals)
self.fx=self.wTree.get_widget("notebook1")
self.reparent_loc(self.fx, self.window)
self.gtkWindow = self.wTree.get_widget("window1")
self.gtkWindow.destroy()
self.window.show()
print 'connecting'
self.sock=BluetoothSocket(RFCOMM)
self.sock.connect(('00:1F:00:B5:3A:45',5))
print "connected."
threading.Thread.__init__(self)
def run(self):
while True:
self.a=self.a+1
self.got.set_text(self.a)
print a
def reparent_loc(self, widget, newParent):
widget.reparent(newParent)
gui().start()
gtk.main()
|
|
2010-04-03
, 14:24
|
|
|
Posts: 385 |
Thanked: 344 times |
Joined on Jan 2010
@ Israel
|
#14
|
| The Following User Says Thank You to omeriko9 For This Useful Post: | ||
|
|
2010-04-03
, 14:31
|
|
Posts: 308 |
Thanked: 62 times |
Joined on Jun 2009
@ Turkiye
|
#15
|
|
|
2010-04-03
, 14:39
|
|
|
Posts: 385 |
Thanked: 344 times |
Joined on Jan 2010
@ Israel
|
#16
|
i posted the full code please could you tell me what should i do about it?
| The Following User Says Thank You to omeriko9 For This Useful Post: | ||
|
|
2010-04-03
, 14:41
|
|
Posts: 308 |
Thanked: 62 times |
Joined on Jun 2009
@ Turkiye
|
#17
|
| The Following User Says Thank You to McLightning For This Useful Post: | ||
|
|
2010-04-08
, 08:52
|
|
Posts: 56 |
Thanked: 31 times |
Joined on Jul 2008
@ Austria
|
#18
|
|
|
2010-04-11
, 19:50
|
|
Posts: 308 |
Thanked: 62 times |
Joined on Jun 2009
@ Turkiye
|
#19
|