2 of 2
2
Getting started Developing Multi-Touch Apps in Python
Posted: 02 May 2009 04:21 PM   [ Ignore ]   [ # 16 ]
Rank
Joined  2009-03-24
Total Posts:  17
New Member

hello
i have now 2 new pbs with MTImageButton and MTKineticList:

1) MTImageButton

i try to change the image of the button dynamically with the following code :

#create MTImageButton
imgopts {'scale'0.2}
imgpath 
'img/img%s.jpg'
img5 MTImageButton(filename=imgpath tuples[0][1], **imgopts)
w.add_widget(img5)

#reload ImageButton's image 
img5.filename='imgpath % tuples[1][1]

Modifying the filename doesn t make any difference
must i reload the widget, but how ? or delete it and recreate ?

2) Dynamically delete all items of a MTKineticList

according to the previous post, i do

evenement_det.add(MTKineticItem(label=str(self), **kinopts), 1)
evenement_det.add(MTKineticImage(filename str(filename),scale 0.5), 2)

#Defines behaviour when MTImageButton is unpressed 
def img_on_release( *largs):
  for 
x in [1,2] evenement_det.delete_item(x)
  
w.remove_widget(evenement_det)

no pb for removing the object but, deleting items returns me this err (even with KineticList’s ‘deletable’ and ‘searchable’ parameters set to True)..

error:
for x in [1,2] : eval(evenement_det_nb).delete_item(x)
File “C:\Program Files\Python25\lib\site-packages\pymt\ui\widgets\kinetic.py”, line 281, in delete_item
self.dispatch_event(’on_delete’, item, self.childmap[item])
KeyError: 1

Profile
 
 
Posted: 03 May 2009 03:14 AM   [ Ignore ]   [ # 17 ]
Avatar
RankRankRank
Joined  2008-12-27
Total Posts:  262
Moderator

1. MTImageButton don’t accept to change filename after instance… Actually, you must to recreate it :/
2. Please report the bug on issue tracker smile

 Signature 

Kivy | PyMT | Movid

Profile
 
 
Posted: 04 May 2009 04:13 PM   [ Ignore ]   [ # 18 ]
Rank
Joined  2009-03-24
Total Posts:  17
New Member

hey ok
1) that s what i did, i remove the widget MTImageButton and then i recreate it and it s fine
2) same for the MTKineticlist widget
thanks!
tris

Profile
 
 
Posted: 06 May 2009 07:42 AM   [ Ignore ]   [ # 19 ]
Rank
Joined  2009-03-24
Total Posts:  17
New Member

hi
do you know a way to import several tuio sources into Pymt or these sources must be concatenate by another app first ?

Profile
 
 
Posted: 06 May 2009 08:10 AM   [ Ignore ]   [ # 20 ]
Avatar
RankRankRank
Joined  2008-12-27
Total Posts:  262
Moderator

I think u’ll must subclass the TouchEventLoop (in pymt/mtpyglet.py), to add more than one TuioGetter().
I can do it for you i don’t known how to do => Issues.

They are no solution instead of doing the job yourself: coding the feature in PyMT, or concatenate.

 Signature 

Kivy | PyMT | Movid

Profile
 
 
Posted: 06 May 2009 08:14 AM   [ Ignore ]   [ # 21 ]
Avatar
RankRankRank
Joined  2008-12-27
Total Posts:  262
Moderator

Maybe i misunderstood the problem.
PyMT act like a UDP Server. They listen to the localhost:3333 port by default.

Many client can send message to PyMT. But if they are no coherence between them, it will not work. (same the same ID for 2 differents touchs, or desync events...).

Work are needed anyway.

 Signature 

Kivy | PyMT | Movid

Profile
 
 
Posted: 06 May 2009 11:05 AM   [ Ignore ]   [ # 22 ]
Rank
Joined  2009-03-24
Total Posts:  17
New Member

eh thanxs
yes the first answer was right . that s what i meant. in order to avoid TUIO packet conflicts when unpacking UDP from several TUIO sources
ok i ll check the code

Profile
 
 
Posted: 22 May 2009 08:39 AM   [ Ignore ]   [ # 23 ]
Rank
Joined  2009-03-24
Total Posts:  17
New Member

hi!
another request about MTSvg
size parameter doesn t work on a MTSvg object, right ?

Profile
 
 
Posted: 20 October 2009 04:02 PM   [ Ignore ]   [ # 24 ]
Avatar
RankRank
Joined  2009-03-10
Total Posts:  178
Member

Hey Xelapond, thanks for the tutorials grin
iv got a question if you dont mind?
this is the code i use for MTButton in my application (a multitouch controller for csound:

#PUSH BUTTONS
def on_press_callback(btn, *largs):
csound.SetChannel(’b%d’ % btn, 1)

def on_release_callback(btn, *largs):
csound.SetChannel(’b%d’ % btn, 0)

for i in range(pbuttonNo):
pbutton.push_handlers(on_press = curry(on_press_callback, i))
pbutton.push_handlers(on_release = curry(on_release_callback, i))

My problem now is how to do something similiar for the toggle buttons in my app, so that the value sent to csound only changes when the button state changes, rather than on every press/release?

 Signature 

Multitouch Music

Profile
 
 
Posted: 20 October 2009 06:56 PM   [ Ignore ]   [ # 25 ]
Avatar
RankRank
Joined  2009-03-10
Total Posts:  178
Member

Got it working just now, the code is:

#TOGGLE BUTTONS
def on_press_callback(btn, touch):
if tbutton[btn].state == ‘down’:
csound.SetChannel(’tb%d’ % btn, 1)
else:
csound.SetChannel(’tb%d’ % btn, 0)

for i in range(tbuttonNo):
tbutton.push_handlers(on_press = curry(on_press_callback, i))

 Signature 

Multitouch Music

Profile
 
 
   
2 of 2
2