[Tutor] Running two applications at once

2009-08-28 Thread Dirk Wangsadirdja

hi,

I'm new to python, and I'm starting with Python 3.1 directly. I have
been learning python for about 2 weeks now. And I have few questions.

Is it possible if I run two applications at once?

For example, if I make a clock/timer application with alarm etc, then I
want exercise with my python, creating other codes, and running it. Is
it possible?

If I can make the application as stand-alone application (executeable
EXE file - I'm using Windows XP), then there should be no problem. But
as far that I know, py2exe doesnt support python version 3 yet.

Does anyone know anyway to convert python to exe for python 3.1?

Thank you.

Dirk

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Running two applications at once

2009-08-28 Thread Dirk Wangsadirdja

hi,

I'm new to python, and I'm starting with Python 3.1 directly. I have 
been learning python for about 2 weeks now. And I have few questions.


Is it possible if I run two applications at once?

For example, if I make a clock/timer application with alarm etc, then I 
want exercise with my python, creating other codes, and running it. Is 
it possible?


If I can make the application as stand-alone application (executeable 
EXE file - I'm using Windows XP), then there should be no problem. But 
as far that I know, py2exe doesnt support python version 3 yet.


Does anyone know anyway to convert python to exe for python 3.1?

Thank you.

Dirk
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Displaying .jpg in Tkinter (Python 3.1)

2009-08-31 Thread Dirk Wangsadirdja

hi,

is there anyway to display a .jpg (or other type) images in Tkinter with 
Python 3.1?


From what I read here in the forum, for Python 2.6 I could use the PIL 
package. But the PIL packages doesnt support Pyton 3.1 yet (from what I 
read on the PIL website).


Are there perhaps other packages or other way to do it without using PIL?

Thanks.
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Displaying .jpg in Tkinter (Python 3.1)

2009-08-31 Thread Dirk Wangsadirdja

Hi,

with Tkinter, you can only display GIF and PGM/PPM images.

when you try to create an PhotoImage object from another file format
(JPG for example), it will give you an error.

Alan Gauld wrote:


"Dirk Wangsadirdja"  wrote

is there anyway to display a .jpg (or other type) images in Tkinter 
with Python 3.1?


You can display a limited set of image types, including GIF and
JPG in Tkinter without PIL. Several Widgets take an image including
the Canvas and Text widgets. I think a label can be an image too,
but am not certain.

The trick is to crate an PhotoImage object  from your file and insert that
into the widget. To change the widget you modify the image object
not the widget.

See here for more info:

http://effbot.org/tkinterbook/photoimage.htm


HTH,




___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] How to iterate through unicode string.

2009-09-04 Thread Dirk Wangsadirdja

Hi allen (and perhaps this goes also for others),

just a suggestion, maybe when we post a problem, we should also mention 
the python version that we use.


Sometimes, different version of python would give different results.

I tried it with Python 3.1 (python 3.x uses unicode for string) and 
Python 2.6.2 (applying the s = u'Büro') and both give me 4 characters.


Sorry, I only have those 2 version installed.

Regards,

Dirk

zhang allen wrote:

Hi Christian,

Thanks for your tip.

But it seems to me still not working again.

i wirte this python code

k = []
s = u'Büro'
for c in s:
 k.append(c)
print k

k=[u'B', u'\xa8', u'\xb9', u'r', u'o']

i still have 5 different chars.



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help deciding between python and ruby

2009-09-04 Thread Dirk Wangsadirdja

Hi,

I've never learned ruby, but from what I read, ruby is a pure OOP 
language, and if you are going to do a lot of web creation, then ruby on 
rails is a good one.


What I can advice is, if you choose to stick with python, perhaps you 
shouldn't use python 3.x, but use python 2.5 (from what I heard, its 
supposed to be the best version?).


Why? many python packages that later on I'm sure you would like to use 
are still based on python 2.x.


I didnt know it before, and I start by learning python 3.1. Since I 
start with that (and because I'm too stubborn), I don't want to start 
learning python 2.x. But thats my choice, and if there are packages that 
I cant use yet, I just have to live with that.


Besides that, I think that most of the python tutorials are still based 
on python 2.x.


In case you're not aware of it, python 3.x is not backward compatible. 
And since there are several changes in python 3.x, it wouldnt be able to 
run python 2.x script.


And if you're planning to make executeable files from your script, as 
far that I know, until now there are no tools to convert python 3.x 
script to executeable yet.




On Fri, 2009-09-04 at 06:18 -0700, dan06 wrote:

I'd like to learn a programming language - and I need help deciding between
python and ruby. I'm interesting in learning what are the difference, both
objective and subjective, between the two languages. I know this is a python
mailing list, so knowledge/experience with ruby may be limited - in which
case I'd still be interested in learning why members of this mailing list
chose python over (or in addition to) any other programming language. I look
forward to the feedback/insight. 

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (no subject)

2009-09-10 Thread Dirk Wangsadirdja
I tested it and it works. But I dont understand why it works. Can 
someone please explain it further? Thanks.


Alan Gauld wrote:


"C or L Smith"  wrote

Or (and I'll duck after I pass on what I just happened across today on 
the web):


###
for i in range(len(word)):
   print word[~i]
###


Neat trick!
Now what does ~ do?... the bitwise inverse.
So it relies on the rules of complementing the binary value
to effectively add one and negate. Sneaky, and a new one on me!

Alan G.


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Sorting 2-d data

2009-09-13 Thread Dirk Wangsadirdja

Lie Ryan wrote:


if you have data like this:
mylist = [
[3, 4, 3, 2, 1],
[2, 1, 1, 1, 1],
[4, 2, 2, 1, 2],
[1, 3, 1, 1, 1],
]

you can use mylist.sort(key=lambda x: x[0])

sorted(mylist, key=lambda x: x[0]) works as well if you need a new list



I have a further question. If I want to sort the list not based on first 
element, but the second, third and so on, then using the lambda works 
nicely.


But for sorting the list with the first element as key, I tried it using 
just mylist.sort() without the lambda, and its working also. Then why 
use the lambda?


Sorry, I'm using python3. so maybe it won't work on python2 with just 
mylist.sort()?

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor