[Tutor] Installing graphics module on python 2.7

2012-05-17 Thread Emeka
Hello All,

I would like to install graphics.
So that I can do this:
import graphics

Please help me. I tried "pip install graphics" nothing came out of it.

Regards, \Janus


-- 
*Satajanus  Nig. Ltd


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


[Tutor] Help with update_wrapper

2011-12-09 Thread Emeka
Hello All,

Could someone explain " functools.update_wrapper" with simple examples?

Regards,
Janus

-- 
*Satajanus  Nig. Ltd


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


Re: [Tutor] Please review my code

2011-09-16 Thread Emeka
Hello Alan,

My bad, I have added the missing folder.

To all, please make out time and review my code. I would like to have your
comments.

https://github.com/janus/Text-Twist

Regards,
emeka

On Fri, Sep 16, 2011 at 1:20 PM, R. Alan Monroe wrote:

>
> > It was only tested on a Windows Box, but I see no reason why it would not
> > work on Unix family. https://github.com/janus/Text-Twist
> > I need you comments.
>
> I think you forgot to upload some needed images along with the python
> code:
>
> ['abase', 'abased', 'abed', 'ads', 'baa', 'baas', 'bad', 'bade', 'bas',
> 'base', 'based', 'bead', 'beads', 'bed', 'beds', 'dab', 'dab
> s', 'debs', 'sad', 'sea']
> Traceback (most recent call last):
>  File "haPu3.py", line 36, in 
>IMAGE = PhotoImage(file=doom_image)  #'C:\Python_way\doom2.gif')
>  File "c:\python25\lib\lib-tk\Tkinter.py", line 3294, in __init__
>Image.__init__(self, 'photo', name, cnf, master, **kw)
>  File "c:\python25\lib\lib-tk\Tkinter.py", line 3250, in __init__
>self.tk.call(('image', 'create', imgtype, name,) + options)
> _tkinter.TclError: couldn't open ".\doom2.gif": no such file or directory
>
> Alan
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
*Satajanus  Nig. Ltd


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


Re: [Tutor] Strange zip syntax

2011-09-16 Thread Emeka
iBrett,

iter

On Fri, Sep 16, 2011 at 3:35 AM, Brett Ritter  wrote:

> I ran into this article (
> http://blog.adku.com/2011/09/hodgepodge-of-python.html ) and found
> myself temporarily stymied by one line it in:
>
> zip(*[iter(a)]*2)
>
> Used like this:
>
> >>> a = ['a','1','b','2','c','3']
> >>> zip(*[iter(a)]*2)
> [('a', '1'), ('b', '2'), ('c', '3')]
>
> While I'm unlikely to use such a construct (if I can't easily follow
> it now, I or my successor likely won't follow it should it need to be
> debugged sometime in the future), I found the education I got in
> deciphering it was worth the effort.  I'm sharing it here so others
> can benefit from my puzzlement.
>
> iter(a) returns a list iterator for a.  See help(iter) for more.
> [iter(a)] is a list containing one element, an iterator.  This is
> created only so we can do the below:
> [iter(a)]*2 is a list containing two elements, each the SAME list iterator.
> For simplicity, let's break this out for further analysis:
>
> >>> b = iter(a)
> >>> c = [b,b]
>

iter(c) returns listiterator



>
> *[iter(a)]*2 flattens the list when passed into a function call.
> Using our more verbose but simple syntax: *c.  This only works when
> passed to a function.
> zip() creates tuples each holding the Nth elements from a number of
> sequences.  See help(zip) for more.
> Thus, zip(a) or zip(a,a) would return:
> >>> zip(a)
> [('a',), ('1',), ('b',), ('2',), ('c',), ('3',)]
> >>> zip(a,a)
> [('a', 'a'), ('1', '1'), ('b', 'b'), ('2', '2'), ('c', 'c'), ('3', '3')]
>
> What happens when we pass an iterator to zip?  That's not mentioned in
> the docstring blurb.
> >>> zip(iter(a))
> [('a',), ('1',), ('b',), ('2',), ('c',), ('3',)]
> Answer: It works as intended.
>
> Now we come to the magic of this little snippet.
> zip(iter(a),iter(a)) wouldn't work, because each call to iter(a)
> returns a DIFFERENT iterator.
> >>> zip(iter(a), iter(a))
> [('a', 'a'), ('1', '1'), ('b', 'b'), ('2', '2'), ('c', 'c'), ('3', '3')]
>
> But by creating the list of two elements each of which is the SAME
> iterator, as each is asked to iterate it advances the common element
> indicator:
> >>> zip(*c)
> [('a', '1'), ('b', '2'), ('c', '3')]
> Notice that the flattening is required, because zip needs to get
> multiple arguments:
> >>> b = iter(a)  #our original iterator is spent, so we're assigning a new
> one
> >>> c = [b,b]
> >>> zip(c)   #Not flattened, is just a single list, like a.
> [(,), ( 0x024E32D0>,)]
> >>> zip(b,b)   # here it is two iterators sent to zip() (though they happen
> to be the SAME iterator)
> [('a', '1'), ('b', '2'), ('c', '3')]
>
> I hope some of you enjoy playing with this, and hopefully someone
> learned something useful!  While I'm not likely to use the listed
> form, I can very well see myself saying:
>
> >>> a = ['a','1','b','2','c','3']   #well, I can see myself using this with
> meaningful variable names
> >>> b = iter(a)
> >>> zip(b,b)  # Group in sets of 2 elements
>
> --
> Brett Ritter / SwiftOne
> swift...@swiftone.org
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
*Satajanus  Nig. Ltd


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


[Tutor] Please review my code

2011-09-15 Thread Emeka
Hello All,


While trying to learn Python I developed a small game, Text Text.  It has
rough edges and may not meet your class. However, by reviewing it you'll be
helping  me to advance.

It was only tested on a Windows Box, but I see no reason why it would not
work on Unix family. https://github.com/janus/Text-Twist
I need you comments.
-- 
*Regards,
Emeka


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


Re: [Tutor] Using type

2011-08-12 Thread Emeka
Chris,

I was just fooling around and I wanted to do something for myself before
going to bed the other night.

func myflatten will turn say [ 34 [90] [12] 1] into [34 90 12 1].

Just like its name sounds.

Emeka

On Fri, Aug 12, 2011 at 7:03 PM, Christopher King wrote:

>   try:
>>  iter(item)  # test for iterability
>>  if len(item) == 1 and item == item[0]:
>>  gut.append(item)
>>  else:
>>  gut = gut + flatten(item)
>>
>>   except TypeError:
>>  gut.append(item)
>>
> I wouldn't put the what you want to do if there is no error in the
> try statement. It makes it appear like your checking for an error in all the
> code. I would do.
>
>   try:
>  iter(item)  # test for iterability
>   except TypeError:
>  gut.append(item)
>   else:
>  if len(item) == 1 and item == item[0]: ##By the way, why do you
> have this if statment
>
>  gut.append(item)
>  else:
>  gut = gut + flatten(item)
>
> Oh ya out of curiosity, what is the flatten func for?
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>


-- 
*Satajanus  Nig. Ltd


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


[Tutor] Using type

2011-08-11 Thread Emeka
Hello All,

I need help here, type(item) == [].__class__:. What is the idiomatic way of
doing it?

def myflatten(my_data):

  gut = []

  for item in my_data:
   if type(item) == [].__class__:
gut =  gut + myflatten ( item)
   else:
 gut.append(item)

  return gut
print myflatten(goo)

-- 
*Satajanus  Nig. Ltd


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


Re: [Tutor] Python scripts into executable Windows programss

2011-08-03 Thread Emeka
Sumod,

Thanks so much ... I was also looking for something like Inno.

Emeka



On Wed, Aug 3, 2011 at 8:04 AM,  wrote:

> For a seamless application development experience, you may want to consider
> these steps.
> 1. Use Eclipse-pydev to write your scripts
> 2. Use py2exe to convert into executable programs
> 3. Use Inno setup to create installers
>
> There is support for 2.6 and 2.7 with Python. Please see the news page -
> http://www.py2exe.org/index.cgi/News
>
> Hope this helps.
>
> Thanks and Regards,
> Sumod
>
>
> On Wed, Aug 3, 2011 at 9:55 AM, Emeka  wrote:
>
>> Hello All,
>>
>> I would want to convert  Python scripts into executable Windows programs.
>> I have already checked out py2exe, it seems like they support only Python
>> 2.5. Mine is Python 2.7.7. Could anyone here help me out on this issue?
>> ?
>>
>> Regards,
>> Emeka --
>> *Satajanus  Nig. Ltd
>>
>>
>> *
>>
>> ___
>> Tutor maillist  -  Tutor@python.org
>> To unsubscribe or change subscription options:
>> http://mail.python.org/mailman/listinfo/tutor
>>
>>
>
>
> --
> http://spawgi.wordpress.com
> We can do it and do it better.
>



-- 
*Satajanus  Nig. Ltd


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


[Tutor] Python scripts into executable Windows programss

2011-08-02 Thread Emeka
Hello All,

I would want to convert  Python scripts into executable Windows programs. I
have already checked out py2exe, it seems like they support only Python 2.5.
Mine is Python 2.7.7. Could anyone here help me out on this issue?
?

Regards,
Emeka --
*Satajanus  Nig. Ltd


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


Re: [Tutor] How to make tkMessage function to have duration

2011-07-30 Thread Emeka
Steven,,


Thanks!


Emeka

On Sat, Jul 30, 2011 at 12:25 PM, Steven D'Aprano wrote:

> Emeka wrote:
>
>> Hello All,
>>
>> Say I have the below(code),  I would want the message to last say 30
>> seconds and afterwards disappear. I won't want the user to be the one to
>> enable it to disappear.
>>
>> Basically, what I want is to be able to show the user some message , and
>> after some seconds, the message goes away
>>
>
> I *hate* it when applications do that. Just as I'm trying to read the
> message, take a screen shot, or whatever, the message disappears. I think
> that's one of the worst things you can do in an application.
>
> If the message isn't important enough to require it to stay visible until
> the user explicitly closes it, then it shouldn't go into a dialog in the
> first place.
>
>
>
> --
> Steven
> __**_
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/**mailman/listinfo/tutor<http://mail.python.org/mailman/listinfo/tutor>
>



-- 
*Satajanus  Nig. Ltd


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


[Tutor] How to make tkMessage function to have duration

2011-07-30 Thread Emeka
Hello All,

Say I have the below(code),  I would want the message to last say 30
seconds and afterwards disappear. I won't want the user to be the one to
enable it to disappear.

Basically, what I want is to be able to show the user some message , and
after some seconds, the message goes away

import Tkinter
import tkMessageBox

top = Tkinter.Tk()
def hello():
   tkMessageBox.showinfo("Say Hello", "Hello World")

B1 = Tkinter.Button(top, text = "Say Hello", command = hello)
B1.pack()

top.mainloop()

-- 
*Satajanus  Nig. Ltd


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


[Tutor] Python Tkinter event activated with time

2011-07-27 Thread Emeka
Hello All,

I am putting together a small game, and I would want to enable my callback
function using time passed.

How to do something like this with Tkinter event.

from time import time

ftime  = time()
   if ftime - time() > 2000:
dosomething



-- 
*Satajanus  Nig. Ltd


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


Re: [Tutor] Question related to Tkinker

2011-07-24 Thread Emeka
for i,cha in enumerate(wordi):

label = Label(root,  image=photoimage, text = cha)
label.grid(row=1, column=i, columnspan=1, rowspan=1,sticky=W+E+N+S,
padx=0, pady=1)
label1 = Label(root,  image=IMAGE)

I used grid ... Though I used labels, I was dealing only on character level.
So for word like "JAVA" . I will have  a row with four cells and each filled
with the individual character so that I could manipulate them individually.

Now, if I late have "ORACLE" in level 2.. I would want to use to write it in
the same row as above however with six cells.

I will check the link you posted




On Sun, Jul 24, 2011 at 8:00 AM, Corey Richardson  wrote:

> Excerpts from Emeka's message of Sun Jul 24 02:56:02 -0400 2011:
> > Hello All,
> >
> > I am putting up a simple game .. the game is about manipulation. If the
> gets
> > through level one ... I have to change the word with another...
> >
> > Am I going to destroy level window and build level 2 or is there a way to
> > just adjust the word (I used labels)
> >
>
> When working with tkinter, http://effbot.org/tkinterbook/ will likely be
> your
> best friend. Specifically, you're going to want
>
> your_label1.config(text="New word!")
> your_label2.config(text="Another!")
> --
> Corey Richardson
>  "Those who deny freedom to others, deserve it not for themselves"
> -- Abraham Lincoln
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>


-- 
*Satajanus  Nig. Ltd


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


[Tutor] Question related to Tkinker

2011-07-23 Thread Emeka
Hello All,

I am putting up a simple game .. the game is about manipulation. If the gets
through level one ... I have to change the word with another...

Am I going to destroy level window and build level 2 or is there a way to
just adjust the word (I used labels)

Regards,
Janus

-- 
*Satajanus  Nig. Ltd


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


Re: [Tutor] Tkinter's Label

2011-02-16 Thread Emeka
Alan,

Thanks so much.

Is the below the standard way of checking the content of Label in "if"
statement?

 root = Tk()
label = Label(root , text = "pure")


if label["pure"] == "pure":


Regards,
Emeka

On Wed, Feb 16, 2011 at 10:13 AM, Alan Gauld wrote:

>
> "Emeka"  wrote
>
>  in order to change "text" , I could do the this
>>
>> label[text] = "pool"
>>
>> I do know that there is something like this..
>>
>> label.configure(text = "pool")
>>
>
> For singlealue changes it's largely a matter of taste but I personally use
> the dictionary form for a single value change and configure() where I am
> changing multiple values at the same time. (Otherwise I'd need to have
> multiple lines changing one value each...)
>
> Thus, if the new label were very long and you wanted to change the width of
> the control to accomodate it you could do
>
> label.configure(text='a very long message indeed', width=50)
>
> HTH,
>
> --
> Alan Gauld
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>



-- 
*Satajanus  Nig. Ltd


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


[Tutor] Tkinter's Label

2011-02-16 Thread Emeka
Hello All,


I have the following;
root = Tk()
label = Label(root , text = "pure")
in order to change "text" , I could do the this

label[text] = "pool"

I do know that there is something like this..

label.config(text = "pool")

Which one should I use?


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