Forum: Python Jun 12th, 2008 |
| Replies: 6 Views: 548 encode = lambda txt: ".".join([str(ord(letter)-96) for letter in txt if ord(letter) in range(97,123)])
decode = lambda txt: "".join([chr(int(char)+96) for char in txt.split(".") if int(char) in... |
Forum: Python Jun 6th, 2008 |
| Replies: 5 Views: 1,398 Google have this thing called the Google App Engine.
Link: http://code.google.com/appengine/docs/whatisgoogleappengine.html |
Forum: Python Jun 2nd, 2008 |
| Replies: 1 Views: 592 when you create a socket, you need to bind it with a port, address so other sockets have something to connect to.
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sock.bind((address,... |
Forum: Python Jun 2nd, 2008 |
| Replies: 2 Views: 1,234 try GUI2exe, it's a gui wrapper for py2exe.
http://xoomer.alice.it/infinity77/main/GUI2Exe.html |
Forum: Python May 30th, 2008 |
| Replies: 5 Views: 585 Hmm.. Well strangely enough it works on my machine (XP)
From idle and from cmd.
Not sure what the problem is, but if you need to get the address of a messege sender then just do that in the... |
Forum: Python May 17th, 2008 |
| Replies: 4 Views: 567 python has a keyword function in that would be useful in your example.
if password in pass_list1:
# do something |
Forum: Python May 16th, 2008 |
| Replies: 1 Views: 507 can you post the traceback? and what module's are you using? |
Forum: Python May 15th, 2008 |
| Replies: 4 Views: 568 there must be something else going on. When you make a copy of a list list2 = list1[:] it fills list2 with list1's values, but when you change either list1 or list2, the change isn't mirrored so... |
Forum: Python May 9th, 2008 |
| Replies: 0 Views: 4,101 For more information on threading read this excellent 4 page tutorial:
http://www.devshed.com/c/a/Python/Basic-Threading-in-Python/ |
Forum: Python May 8th, 2008 |
| Replies: 6 Views: 796 Thanks.
Yea not a problem i'll put it there now.
And I will look up the python code guidlines thing (i have heard of it before to be honest) i'm just lazy hehe. |
Forum: Python May 8th, 2008 |
| Replies: 6 Views: 1,101 # This is meant to draw Start and Stop buttons and a label
# The Start button should start a loop in which the label
# is configured to change colour and text.
# At each pass through the loop the... |
Forum: Python May 7th, 2008 |
| Replies: 10 Views: 2,415 |
Forum: Python May 7th, 2008 |
| Replies: 10 Views: 2,415 You don't need to get a fileobject though. As solsteel pointed out, the csv module doesn't need a fileobject, it just needs something to iterate through, so if you split the self[filename] string by... |
Forum: Python May 7th, 2008 |
| Replies: 10 Views: 2,415 well as far as i can see, whatever resides within self[filename] is clearly not a valid filepath.
There was a sort of hint to what it might contain in the second error.
... |
Forum: Python May 7th, 2008 |
| Replies: 4 Views: 2,630 def function(*args):
print type(args)
print args
function('arg1', 'arg2', 'arg3')
output
<type 'tuple'>
('arg1', 'arg2', 'arg3') |
Forum: Python May 7th, 2008 |
| Replies: 6 Views: 1,101 You should definitely use tkinters .after() function, it enters a local event loop which means it doesn't block your program.
def blink(self):
if not self.stop: # check self.stop is... |
Forum: Python May 7th, 2008 |
| Replies: 2 Views: 660 n = float(2)
m = float(3)
print n/m
Or
n = 2.0
m = 3.0
print n/m |
Forum: Python May 7th, 2008 |
| Replies: 6 Views: 796 Well you could just use a Thread object to do the counting for you and then in your main program everytime the user enters a key, you just call a function of the Thread object counting that returns... |
Forum: Python Apr 25th, 2008 |
| Replies: 3 Views: 1,037 hmm.. what module is this 'call' function from?
because it's not a builtin / keyword function |
Forum: Python Apr 24th, 2008 |
| Replies: 6 Views: 571 >>> string = "A simple example string."
>>> if 'example' in string:
print 'the word \'%s\' is in: "%s"' % ('example', string)
the word 'example' is in: "A simple example string."
>>> |
Forum: Python Apr 24th, 2008 |
| Replies: 3 Views: 722 http://www.devshed.com/c/a/Python/Basic-Threading-in-Python/
An excellent relatively short tutorial about threads, it's brief (4 pages) but i found it very useful.
As much as... |
Forum: Python Apr 23rd, 2008 |
| Replies: 3 Views: 529 >>> exec("print 2")
2
>>> exec("print 2+2")
4
>>> exec("vars = (var1, var2, var3, var4) = 'a', (1,'2',3.0), 44, 0.7\nfor v in vars:\n print v, '=', type(v)")
a = <type 'str'>
(1, '2', 3.0) =... |
Forum: Python Apr 22nd, 2008 |
| Replies: 1 Views: 409 playerScores = {"player1":0, "player2":0}
...
...
if player1 won:
playerScores["player1"] += 1
elif player2 won:
playerScores["player2"] += 1
for player in playerScores.keys():
... |
Forum: Python Apr 22nd, 2008 |
| Replies: 3 Views: 722 Well if your running your tkinter gui by calling: root.mainloop() or something similiar then you should change that to:
while 1:
root.update()
#repeat code here
You do everything as... |
Forum: Python Apr 17th, 2008 |
| Replies: 2 Views: 669 Hi all!
Just wondering if it was possible to be able to create a Tkinter window that can handle files being 'dropped' on it.
What i want is to be able to drag a file from an explorer window to... |
Forum: Python Apr 15th, 2008 |
| Replies: 3 Views: 639 http://www.devshed.com/c/a/Python/Basic-Threading-in-Python/
A guide to threading i found very useful |
Forum: Python Apr 15th, 2008 |
| Replies: 3 Views: 639 Personally i would use threading (thats the short answer)
As far as how to go about it, you've got a big project on your hands. |
Forum: Python Apr 15th, 2008 |
| Replies: 11 Views: 881 don't hijack eggowaffles thread ramakrishnakota, if you need help and it's not related to this guy start a new thread |
Forum: Python Apr 6th, 2008 |
| Replies: 8 Views: 1,031 did you define gold?
gold = gold + 5
if 'gold' is not defined before that statement then it doesn't know what to add 5 onto. |
Forum: Python Apr 5th, 2008 |
| Replies: 70 Views: 7,099 competition?
easier for a giant like MS to keep python in 'check' than allow another powerful open source language like python which could result in a drop in sales if software becomes easier to... |
Forum: Python Apr 4th, 2008 |
| Replies: 70 Views: 7,099 from - http://www.jython.org/Project/userfaq.html |
Forum: Python Apr 3rd, 2008 |
| Replies: 70 Views: 7,099 java is just like python, it's just that java's virtual machine is a hell of a lot more widely spread, known and used than pythons interpretter.
why do you think Jython is so good at what it does. |
Forum: Python Apr 2nd, 2008 |
| Replies: 7 Views: 1,189 hahahaha!!!! i was typing away and hit enter without even pasting the link in :)
terribly sorry
http://docs.python.org/ref/customization.html |
Forum: Python Apr 2nd, 2008 |
| Replies: 7 Views: 1,189 i'm not sure, i havn't used the double underscore methods much (if at all) but as far as i am aware, the __str__ method links with the 'print' keyword, so if print object is called then that objects... |
Forum: Python Apr 2nd, 2008 |
| Replies: 7 Views: 1,189 well, if you want to be able to 'print' the kangaroo instance in your case your trying to print 'kanga' then just make the '__str__' method return a string and that string will get printed:
...... |
Forum: Python Apr 2nd, 2008 |
| Replies: 7 Views: 1,189 not sure what you mean exactly, but why are you creating a temporary instance of Kangaroo in the put in pouch function?
I thought you meant you wanted roo's pouch added into kanga's pouch?
if... |
Forum: Python Mar 30th, 2008 |
| Replies: 2 Views: 1,227 oh my goodness that is all i needed to know!!
thankyou v.much:) |
Forum: Python Mar 30th, 2008 |
| Replies: 70 Views: 7,099 hehe, nicely put vega, i totally forgot about that beautiful aspect of python |
Forum: Python Mar 30th, 2008 |
| Replies: 2 Views: 1,227 Hi,
I'm wondering how your supposed to find out a widget's width in tkinter..
Little example code to explain (doesnt do anything at all)
class CustomWidget(Tkinter.Frame):
def... |
Forum: Python Mar 30th, 2008 |
| Replies: 70 Views: 7,099 python has defiantly spioled me!
i hate the look of other languages even tho i'd love to learn them.. whenever i try.. i end up going back to python just cause it's so much clearer and quicker to... |