Re: [Tutor] How to have the name of a function inside the code of this function?

2012-04-06 Thread Karim
Le 07/04/2012 04:01, Dave Angel a écrit : On 04/06/2012 03:19 PM, Karim wrote: Le 06/04/2012 19:31, Alan Gauld a écrit : On 06/04/12 09:47, Karim wrote: If you have any idea to get the caller name inside the caller. Its not normally very helpful since in Python the same function can have ma

Re: [Tutor] Tkinter GUI crashing problem

2012-04-06 Thread Steven D'Aprano
myles broomes wrote: Im working the Tkinter and I'm having a problem with the GUI I made. It crashes whenever I hit the submit button. Heres my code: Define "crashes". Does it: * cause your computer to Blue Screen of Death? * lock up your computer until you Ctrl-Alt-Delete? * cause Windows t

Re: [Tutor] How to have the name of a function inside the code of this function?

2012-04-06 Thread Dave Angel
On 04/06/2012 03:19 PM, Karim wrote: > Le 06/04/2012 19:31, Alan Gauld a écrit : >> On 06/04/12 09:47, Karim wrote: >> >>> If you have any idea to get the caller name inside the caller. >> >> >> Its not normally very helpful since in Python the same function can >> have many names: >> >> def F(x):

Re: [Tutor] Emailing code

2012-04-06 Thread Steven D'Aprano
myles broomes wrote: This question isnt so much related to a specific program, just something im curious about. What is the best way to email code? I find that when i copy and paste it into an email, the indentation and spacing gets all messed up. Don't send HTML, because that is poison to corr

Re: [Tutor] Tkinter GUI crashing problem

2012-04-06 Thread Alan Gauld
On 06/04/12 23:07, myles broomes wrote: Im working the Tkinter and I'm having a problem with the GUI I made. > It crashes whenever I hit the submit button. Heres my code: What do you mean by crashes? It looks to me like it should lock up rather than crash. Your update_txt method goes into an

Re: [Tutor] How do you save work in progress in Pyscripter ?

2012-04-06 Thread Alan Gauld
On 06/04/12 20:11, Thomas Mujica wrote: *Was able to write and successfully run this but I can’t seem to be able to “save” it* You have written the code at the interactive prompt which is really intended for experimenting. To save the code as a python script you need to create a plain text

Re: [Tutor] Tkinter GUI crashing problem

2012-04-06 Thread Emile van Sebille
On 4/6/2012 3:07 PM myles broomes said... import random from tkinter import * What version of python on what platform please... Emile ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/m

[Tutor] Tkinter GUI crashing problem

2012-04-06 Thread myles broomes
Im working the Tkinter and I'm having a problem with the GUI I made. It crashes whenever I hit the submit button. Heres my code: #Guess my number 2.0 #The guess my number game but using a GUI import random from tkinter import * class Application(Frame): """GUI to hold widgets. ""

Re: [Tutor] Emailing code

2012-04-06 Thread wesley chun
On Fri, Apr 6, 2012 at 12:14 PM, myles broomes wrote: > This question isnt so much related to a specific program, just something im > curious about. What is the best way to email code? I find that when i copy > and paste it into an email, the indentation and spacing gets all messed up. as an alt

[Tutor] How do you save work in progress in Pyscripter ?

2012-04-06 Thread Thomas Mujica
Please help a newbie Was able to write and successfully run this but I can't seem to be able to "save" it Luckily I had saved it to Word and then I was able to copy and paste it back into PyScripter. I'm using Python Scripter Version 2.5.3.0 x86 *** Python 2.7.2 (default, Jun 1

Re: [Tutor] Emailing code

2012-04-06 Thread Emile van Sebille
On 4/6/2012 12:14 PM myles broomes said... This question isnt so much related to a specific program, just something im curious about. What is the best way to email code? I find that when i copy and paste it into an email, the indentation and spacing gets all messed up. Set your email client c

Re: [Tutor] How to have the name of a function inside the code of this function?

2012-04-06 Thread Karim
Le 06/04/2012 19:31, Alan Gauld a écrit : On 06/04/12 09:47, Karim wrote: If you have any idea to get the caller name inside the caller. Its not normally very helpful since in Python the same function can have many names: def F(x): return x*x a = F b = F c - lambda y: F(y) print F(1)

[Tutor] Emailing code

2012-04-06 Thread myles broomes
This question isnt so much related to a specific program, just something im curious about. What is the best way to email code? I find that when i copy and paste it into an email, the indentation and spacing gets all messed up. Myles Broomes _

Re: [Tutor] How to use g_timeout_add () function?

2012-04-06 Thread Mark Lawrence
Please don't top post and please reply to the list Top posting fixed. - Forwarded Message - From: Lion Chen To: Mark Lawrence Cc: Sent: Friday, 6 April 2012, 16:43 Subject: Re: [Tutor] How to use g_timeout_add () function? fixed top posting > On 06/04/2012 15:17, Lion Chen wrote: >>

Re: [Tutor] How to have the name of a function inside the code of this function?

2012-04-06 Thread Alan Gauld
On 06/04/12 09:47, Karim wrote: If you have any idea to get the caller name inside the caller. Its not normally very helpful since in Python the same function can have many names: def F(x): return x*x a = F b = F c - lambda y: F(y) print F(1), a(2), b(3), c(4) Now, why would knowing

Re: [Tutor] which gets called

2012-04-06 Thread John Fabiani
On Friday, April 06, 2012 06:54:28 AM John Fabiani wrote: > Hi, > > I want to create a class that inherits two other classes. > > class NewClass( A,B) > > But both "A" and "B" contain a method with the same name ("onKeyDown"). > > If my "NewClass" does not contain something to override the meth

Re: [Tutor] which gets called

2012-04-06 Thread Mark Lawrence
On 06/04/2012 14:54, John Fabiani wrote: Hi, I want to create a class that inherits two other classes. class NewClass( A,B) But both "A" and "B" contain a method with the same name ("onKeyDown"). If my "NewClass" does not contain something to override the methods which one would be called if

Re: [Tutor] How to use g_timeout_add () function?

2012-04-06 Thread Mark Lawrence
On 06/04/2012 15:17, Lion Chen wrote: Hello all, i have a question: when i check gtk_time_out in the gtk+2 reference, it said " |gtk_timeout_add|has been deprecated since version 2.4 and should not be used in newly-written code. Use |g_timeout_add()|instead." but i don't know how tu use the g_t

Re: [Tutor] which gets called

2012-04-06 Thread Brian van den Broek
On 6 April 2012 15:54, John Fabiani wrote: > Hi, > > I want to create a class that inherits two other classes. > > class NewClass( A,B) > > But both "A" and "B" contain a method with the same name ("onKeyDown"). > > If my "NewClass" does not contain something to override the methods which one > wo

Re: [Tutor] which gets called

2012-04-06 Thread Steven D'Aprano
John Fabiani wrote: Hi, I want to create a class that inherits two other classes. class NewClass( A,B) But both "A" and "B" contain a method with the same name ("onKeyDown"). If my "NewClass" does not contain something to override the methods which one would be called if myinstance = NewC

Re: [Tutor] How to use g_timeout_add () function?

2012-04-06 Thread Evert Rol
> Hello all, i have a question: > > when i check gtk_time_out in the gtk+2 reference, it said " gtk_timeout_add > has been deprecated since version 2.4 and should not be used in newly-written > code. Use g_timeout_add() instead." > > but i don't know how tu use the g_timout_add() function: > m

Re: [Tutor] which gets called

2012-04-06 Thread Evert Rol
> Hi, > > I want to create a class that inherits two other classes. > > class NewClass( A,B) > > But both "A" and "B" contain a method with the same name ("onKeyDown"). > > If my "NewClass" does not contain something to override the methods which one > would be called if > > myinstance = New

Re: [Tutor] a problem with a server and client

2012-04-06 Thread Khalid Al-Ghamdi
actually, you are right... in addition to that problem, there was the encodeing/decoding issue you mentioned on both the client and server. thanks On Fri, Apr 6, 2012 at 5:08 PM, Khalid Al-Ghamdi wrote: > yah i did the search, and tried the solution, but it didn't work nice > of you to have

[Tutor] How to use g_timeout_add () function?

2012-04-06 Thread Lion Chen
Hello all, i have a question: when i check gtk_time_out in the gtk+2 reference, it said " |gtk_timeout_add|has been deprecated since version 2.4 and should not be used in newly-written code. Use |g_timeout_add()|instead." but i don't know how tu use the g_timout_add() function: my_id = g_timeout_

Re: [Tutor] a problem with a server and client

2012-04-06 Thread Khalid Al-Ghamdi
yah i did the search, and tried the solution, but it didn't work nice of you to have tried, though... anyhow, i found where the problem is... on the client side it should be connect() instead of bind() in : > tcpCliSock.bind(ADDR) thanks On Fri, Apr 6, 2012 at 4:59 PM, Evert Rol wrote: >

[Tutor] which gets called

2012-04-06 Thread John Fabiani
Hi, I want to create a class that inherits two other classes. class NewClass( A,B) But both "A" and "B" contain a method with the same name ("onKeyDown"). If my "NewClass" does not contain something to override the methods which one would be called if myinstance = NewClass() myinstance.onKe

Re: [Tutor] a problem with a server and client

2012-04-06 Thread Evert Rol
> i'm trying to implement a server that adds a time stamp to incoming text form > a client. > > the server's code is (but doesn't seem to have the problem as demoed by the > error below: > > from socket import * > from time import ctime > > HOST = '' > PORT = 21567 > BUFSIZ = 1024 > ADDR =(HOS

[Tutor] a problem with a server and client

2012-04-06 Thread Khalid Al-Ghamdi
hi, i'm trying to implement a server that adds a time stamp to incoming text form a client. the server's code is (but doesn't seem to have the problem as demoed by the error below: from socket import * from time import ctime HOST = '' PORT = 21567 BUFSIZ = 1024 ADDR =(HOST, PORT) tcpSerSock =

Re: [Tutor] How to have the name of a function inside the code of this function?

2012-04-06 Thread Modulok
On 4/6/12, Karim wrote: > > Hello all, > > > I have : > > def foo(): > print( getattr(foo, 'func_name')) > > Where I get the name of the function but I add to give the name of this > function. Indeed it is not very helpful... > I checked the globals() but how I can do to get > glo

Re: [Tutor] Is socket.socket() a func or a class

2012-04-06 Thread Steven D'Aprano
Khalid Al-Ghamdi wrote: hi all, I'm reading this book that says when creating a socket you have to use the socket.socket() *function *as in : ss=socket.socket() but whey i check they type it says it's a class which makes sense cause you're creating a socket object. type(ss) so, which is i

Re: [Tutor] How to have the name of a function inside the code of this function?

2012-04-06 Thread Steven D'Aprano
Karim wrote: Hello all, I have : def foo(): print( getattr(foo, 'func_name')) Why not this? def foo(): print 'foo' You already know the name of the function. There is no portable way of retrieving the name of the current function from within that function. -- Ste

[Tutor] How to have the name of a function inside the code of this function?

2012-04-06 Thread Karim
Hello all, I have : def foo(): print( getattr(foo, 'func_name')) Where I get the name of the function but I add to give the name of this function. Indeed it is not very helpful... I checked the globals() but how I can do to get globals()['toto'].func_name. This is not more he

Re: [Tutor] Is socket.socket() a func or a class

2012-04-06 Thread Alan Gauld
On 06/04/12 07:10, Khalid Al-Ghamdi wrote: I'm reading this book that says when creating a socket you have to use the socket.socket() _function _as in : ... >>> type(ss) so, which is it? or do authors loosely use these terms interchangeably in this context? It just looks like sloppy termi

Re: [Tutor] Running scripts at login

2012-04-06 Thread Alan Gauld
On 06/04/12 03:07, Michael Lewis wrote: What if I want to send the executable to someone and have their machine run the script at startup? Assume I don't have access to their machine to add the script to the startup program group. How can I make that happen? When you say executable in referen