1 of 2
1
Getting started Developing Multi-Touch Apps in Python
Posted: 25 August 2008 10:47 AM   [ Ignore ]
Avatar
RankRankRankRank
Joined  2008-04-22
Total Posts:  525
Elite

I have started a tutorial series on by Blog, showing people how to write Multi-Touch Apps in Python.  The first installment has been posted.  Sorry if its a little short or lacking, I am going to post a second part later this week doing some more exciting stuff.

As usual, All feedback and questions are appreciated.  Here is the link:
http://xelapondsstuff.wordpress.com/2008/08/25/getting-started-with-multi-touch-development-in-python/#more-153

 Signature 

I am more then willing to to test your Multi-Touch programs on Linux, PM me if you have something.  If you’re looking for something faster then AS3 and Easier then C, try Python!

My Blog

Profile
 
 
Posted: 26 August 2008 10:46 AM   [ Ignore ]   [ # 1 ]
Avatar
RankRankRankRank
Joined  2008-04-22
Total Posts:  525
Elite

Here is the second part:
http://xelapondsstuff.wordpress.com/2008/08/26/getting-started-with-multi-touch-development-in-python-part-2/

 Signature 

I am more then willing to to test your Multi-Touch programs on Linux, PM me if you have something.  If you’re looking for something faster then AS3 and Easier then C, try Python!

My Blog

Profile
 
 
Posted: 26 August 2008 08:05 PM   [ Ignore ]   [ # 2 ]
Avatar
Rank
Joined  2007-09-13
Total Posts:  15
New Member

I already know something of python, this tutorial will be helpfull!
Thanks for the tutorial :D

Profile
 
 
Posted: 29 September 2008 11:34 PM   [ Ignore ]   [ # 3 ]
Avatar
RankRankRankRank
Joined  2008-04-22
Total Posts:  525
Elite

Third Part:

http://xelapondsstuff.wordpress.com/2008/09/30/getting-started-with-multi-touch-development-in-python-part-3/

 Signature 

I am more then willing to to test your Multi-Touch programs on Linux, PM me if you have something.  If you’re looking for something faster then AS3 and Easier then C, try Python!

My Blog

Profile
 
 
Posted: 30 September 2008 01:52 AM   [ Ignore ]   [ # 4 ]
Rank
Joined  2008-07-21
Total Posts:  21
New Member

Nice. You should look into getting the code to have a horizontal scroll bar or something though, because right now it’s running into the navigation area on the right.
I would suggest maybe some reference links at the end of the tutorial for people to easily get more information on what is covered within the tutorial. I noticed you had a few within the text, but it would be nice to collect them at the end so one doesn’t have to search back through for them later.
Otherwise, nice beginner tutorials.

Profile
 
 
Posted: 30 September 2008 11:20 PM   [ Ignore ]   [ # 5 ]
Avatar
RankRankRankRank
Joined  2008-04-22
Total Posts:  525
Elite

Good ideas, thanks for the input!  How would I go about putting scroll bars on the code?  I am by no means a web person, and Googling did not bring anything up that is compatible with Wordpress.

 Signature 

I am more then willing to to test your Multi-Touch programs on Linux, PM me if you have something.  If you’re looking for something faster then AS3 and Easier then C, try Python!

My Blog

Profile
 
 
Posted: 02 April 2009 06:14 PM   [ Ignore ]   [ # 6 ]
Rank
Joined  2009-03-24
Total Posts:  17
New Member

hi everyone
first of all for this new 0.2 version of PYMT, this is totally amazing
thanxs people who worked on that thing i m very glad that exists

my question is the following
i m trying to build a customized widget containing an image and different text containers

i tried to use MTAbstractFormWidget for that
but i don t exactly understand its usage .

am i wrong ?
thanxs in advance
Tris

Profile
 
 
Posted: 02 April 2009 06:15 PM   [ Ignore ]   [ # 7 ]
Avatar
RankRankRankRank
Joined  2008-04-22
Total Posts:  525
Elite

I’m not entirely sure what you mean, do you want to be able to edit this text?  Come join us on IRC(#pymt), then we can help you in real time.

 Signature 

I am more then willing to to test your Multi-Touch programs on Linux, PM me if you have something.  If you’re looking for something faster then AS3 and Easier then C, try Python!

My Blog

Profile
 
 
Posted: 03 April 2009 02:22 AM   [ Ignore ]   [ # 8 ]
Avatar
RankRankRank
Joined  2008-12-27
Total Posts:  262
Moderator

MTAbstractFormWidget is designed to start a Form widget. A form widget take care of his size / layout, and dispatch it to his children.
Exemple of Widget based on MTAbstractFormWidget are MTFormCheckbox, MTFormSlider....
Take a look on the code !

 Signature 

Kivy | PyMT | Movid

Profile
 
 
Posted: 03 April 2009 07:17 PM   [ Ignore ]   [ # 9 ]
Rank
Joined  2009-03-24
Total Posts:  17
New Member

hey thanks for quick answer
i got the difference . form is form
so i ll use a tab containing a label widget, and an image widget. if i can solve my MTTabs [NameError: name ‘MTTabs’ is not defined] and [NameError: name ‘MTLabel’ is not defined] pbs under XP

Profile
 
 
Posted: 03 April 2009 07:52 PM   [ Ignore ]   [ # 10 ]
Avatar
RankRankRank
Joined  2008-12-27
Total Posts:  262
Moderator

Mmh, MTTabs and MTLabel exist, even under XP. Please ensure you’ve running setup of 0.2, or ensure you don’t run an old v0.1.

 Signature 

Kivy | PyMT | Movid

Profile
 
 
Posted: 03 April 2009 09:05 PM   [ Ignore ]   [ # 11 ]
Rank
Joined  2009-03-24
Total Posts:  17
New Member

yep so stupid. i thought MTLabel was in 0.1 too
i forgot to launch the setup.py. works now smile

Profile
 
 
Posted: 27 April 2009 04:29 PM   [ Ignore ]   [ # 12 ]
Rank
Joined  2009-03-24
Total Posts:  17
New Member

Hi
i m now a bit disapointed by my 2 pbs

1) First of all here is my KineticList :
evenement_det = MTKineticList(pos=(100, 20),size=(200, 300),w_limit=1, title=’’, friction=10, deletable=’false’, searchable=’false’, velstop=1.5)

deletable and searchable are set to ‘false’ but i still get the buttons (X and S) appearing on the KineticList..

2) Then i have another serie object of ImageButtons
img5 = MTImageButton(filename=’img/img’+str(tuples[5][0])+’.jpg’, scale=0.2)
img6 = MTImageButton(filename=’img/img’+str(tuples[6][0])+’.jpg’, scale=0.2)
img7 = MTImageButton(filename=’img/img’+str(tuples[7][0])+’.jpg’, scale=0.2)

the display works fine.

And i do this :

@img5.event
def on_press(a,b,c):

evenement_det.add(MTKineticItem(label= str(tuples[5][1]), font_size = 6, size=(100,25),border_radius = 5))

@img6.event
def on_press(a,b,c):

evenement_det.add(MTKineticItem(label= str(tuples[6][1]), font_size = 6, size=(100,25),border_radius = 5))

@img7.event
def on_press(a,b,c):

evenement_det.add(MTKineticItem(label= str(tuples[7][1]), font_size = 6, size=(100,25),border_radius = 5))

which is ridiculous . please i would like to know how to optimize this by including a 4th argument to the on_press function which is the name of ImageButton which is pressed

thanks in adv

Profile
 
 
Posted: 27 April 2009 05:41 PM   [ Ignore ]   [ # 13 ]
Avatar
RankRankRankRank
Joined  2008-04-22
Total Posts:  525
Elite

I don’t fully understand what you are trying to do, but if you come find us on IRC(#pymt on irc.freenode.net) I am happy to help resolve your problems.  PyMT is very early, and we are still developing it.  It would be great to hear from end users and developers about what we could do to make using and developing with it easier.

 Signature 

I am more then willing to to test your Multi-Touch programs on Linux, PM me if you have something.  If you’re looking for something faster then AS3 and Easier then C, try Python!

My Blog

Profile
 
 
Posted: 27 April 2009 05:52 PM   [ Ignore ]   [ # 14 ]
Avatar
RankRankRank
Joined  2008-12-27
Total Posts:  262
Moderator

About getting button, ‘false’ is different than False. (the first is a string, the second is a boolean). Use False for deletable and searchable.
And for your MTImageButton & event, you can rewrite with something like this :

imgopts 'scale'0.2 }
imgpath 
'img/img%s.jpg'

def img_on_press(selflabel, *largs):
  
kinopts 'font_size'6'size': (100,25), 'border_radius'5 }
  evenement_det
.add(MTKineticItem(label=str(label), **kinopts))

img5 MTImageButton(filename=imgpath tuples[5][0], **imgopts)
img5.push_handlers(on_press=curry(img_on_presstuples[5][1]))
img6 MTImageButton(filename=imgpath tuples[6][0], **imgopts)
img6.push_handlers(on_press=curry(img_on_presstuples[6][1]))
img7 MTImageButton(filename=imgpath tuples[7][0], **imgopts)
img7.push_handlers(on_press=curry(img_on_presstuples[7][1]))

With some explanations :

1. imgopts and kinopts are dict, and they are expanded in function if you call is with **.
So, MTImageButton(**imgopts) will become MTImageButton(font_size=6, size=.....).

2. curry is an helper function, who prepend argument to a function definition
Basic case, you push a button, you want to pass own information in callback. Without curry,
you’ll need to use global var, and bad trick.

def btn_press(touchIDxy):
  print 
'you click me, but which me ?'
btn MTButton(label='Click Me')
btn.push_handlers(on_press=btn_press)

With curry :

def btn_press(button_instancetouchIDxy):
  print 
'you click me, you known me : 'button_instance.label
btn 
MTButton(label='Click Me')
btn.push_handlers(on_press=curry(btn_pressbtn))

Which could be simplified if you don’t use the callback default arguments, replace btn_press with :

def btn_press(button_instance, *largs):
  
# optional, you can retrieve arguments in largs with :
  # touchID, x, y = largs
  
...

 Signature 

Kivy | PyMT | Movid

Profile
 
 
Posted: 28 April 2009 02:03 PM   [ Ignore ]   [ # 15 ]
Rank
Joined  2009-03-24
Total Posts:  17
New Member

hey Thanks so much AGAIN for getting me a bit more into Python
i havn t tested everything yet

1) but i found some bug (on XP 32bits sorry) when MTKineticList s searchable parameter is set to False

evenement_det = MTKineticList(pos=(10, 10),size=(200, 300),w_limit=1, title=’’, friction=10, deletable=False, searchable=False, velstop=1.5)

temporarly solved by modifying kinetic.py
i reported this on the bug tracker

2) The curry explanation is fucking great

i just replaced
def img_on_press(self, label, *largs):
kinopts = { ‘font_size’: 6, ‘size’: (100,25), ‘border_radius’: 5 }
evenement_det.add(MTKineticItem(label=str(label), **kinopts))

by
def img_on_press(self, label, *largs):
kinopts = { ‘font_size’: 6, ‘size’: (100,25), ‘border_radius’: 5 }
evenement_det.add(MTKineticItem(label=str(self), **kinopts))

then i get exactly what i want

Profile
 
 
   
1 of 2
1