Forum: Python 11 Hours Ago |
| Replies: 3 Views: 151 If you have Python3 you can take a look at cturtle.py and see what this person did to customize the standard turtle.py
Free download from:... |
Forum: Python Jul 5th, 2009 |
| Replies: 4 Views: 364 Assuming you are using Python2, you could do it like this:
print("Enter zero for the value you are looking for:")
s = d = t = 0
while True:
s = input("Speed (miles/hour): ")
d =... |
Forum: Python Jul 3rd, 2009 |
| Replies: 9 Views: 417 One major flaw in your program is in function encyclo(). There you put up the picture and info for mk1, but immediately delete it to put up the picture and info of mk2. |
Forum: Python Jul 2nd, 2009 |
| Replies: 9 Views: 417 Use either Tkinter.END or 'end' |
Forum: Python Jul 2nd, 2009 |
| Replies: 12 Views: 624 Thanks for the info jlm699! |
Forum: Python Jul 2nd, 2009 |
| Replies: 12 Views: 624 There must be something wrong at sourceforge, right now every download request for wxpython2.8 flips into the wxPython2.7.1.2 page :)
This direct link may work:... |
Forum: Python Jul 1st, 2009 |
| Replies: 12 Views: 504 Forgot to mention this, but I also corrected line 10 to:
self.fileMenu.Append(ID_FILE_QUIT, '&Quit\tCtrl+Q') |
Forum: Python Jul 1st, 2009 |
| Replies: 6 Views: 276 Zetlin, your code was almost there:
def test():
number = input("Number: ")
scale = range(1, number+1)
total = 0
for count in scale:
n = count * 20
print n
... |
Forum: Python Jul 1st, 2009 |
| Replies: 7 Views: 352 I ran this from the IDLE editor:
s = u'Rash\u00f4mon'
print s # --> Rashômon
a = u'\u00bfC\u00f3mo es usted?'
print a # --> ¿Cómo es usted? |
Forum: Python Jul 1st, 2009 |
| Replies: 5 Views: 2,137 Use something like this:
s = "Function1 (text1) (text2) (text3) [text4]"
print s.count('(')
print s.count(')')
print s.count('[')
print s.count(']') |
Forum: Python Jul 1st, 2009 |
| Replies: 7 Views: 476 You could use / both Windows and Unix allow that. |
Forum: Python Jul 1st, 2009 |
| Replies: 14 Views: 437 Python code is actually very similar to your Perl code, just a bit more readable:
# Convert string "HelloPythonWorld" to "HELLO_PYTHON_WORLD"
s1 = "HelloPythonWorld"
s2 = ""
for index, c in... |
Forum: Python Jun 30th, 2009 |
| Replies: 12 Views: 504 If paulthom12345's suggestion does not fix your problem, try to bind this way:
import wx
ID_FILE_QUIT = 101
class MainFrame(wx.Frame):
def __init__(self, title):
... |
Forum: Python Jun 30th, 2009 |
| Replies: 5 Views: 300 Give us an example of the filenames, are they distinguishable so they can be grouped? |
Forum: Python Jun 30th, 2009 |
| Replies: 3 Views: 1,199 Try to change your print line to:
print ("The sum of "+str(a)+" and "+str(b)+" is: "+str(a+b))
or even better:
print ("The sum of %s and %s is: %s " % (a, b, (a+b)))
Now remember in Python2... |
Forum: Python Feb 17th, 2009 |
| Replies: 1 Views: 1,055 Works fine for me. What is your total error message? |
Forum: Python Oct 29th, 2008 |
| Replies: 4 Views: 517 Thanks, that works. However, since dice is already a list, why do I have to use list(dice)? |
Forum: Python Oct 29th, 2008 |
| Replies: 4 Views: 517 I was looking at some statistical evaluations of a dice roll and stumbled onto this strange result:
import random
# faces of a dice
dice = [1, 2, 3, 4, 5, 6]
rolls = []
for k in range(3):
... |
Forum: Python Sep 28th, 2008 |
| Replies: 9 Views: 2,395 Try this:
num = [1,2,3,4,5,6]
print sum(num) |
Forum: Python Sep 16th, 2008 |
| Replies: 12 Views: 3,857 This will give you an error:
Traceback (most recent call last):
File "<module1>", line 23, in <module>
File "<module1>", line 21, in test
TypeError: test() takes exactly 1 argument (0 given) |
Forum: Python Sep 8th, 2008 |
| Replies: 3 Views: 972 You could also make up your time string this way:
import time
time_str = time.strftime("%A %B %d %Y %H hours %M minutes and %S seconds",
time.localtime())
print time_str # Monday... |
Forum: Python Sep 8th, 2008 |
| Replies: 3 Views: 454 What are you appending to, and what does line look like? Use a test print of variable line. |
Forum: Python Aug 15th, 2008 |
| Replies: 10 Views: 1,109 Oh yeah, like:
print 'racecar' == 'racecar'[::-1] # True
:) |
Forum: Python Jun 20th, 2008 |
| Replies: 2 Views: 691 Think about it ...
distAppart < factor
distAppart > -factor
Both statements are true so it prints what it is supposed to. |
Forum: Python Jun 13th, 2008 |
| Replies: 2 Views: 491 I have started to use the PyScripter IDE and really like the many features it has. However, everytime I make an error in the code, and as a beginner I make a lot of errors, it rather ungraciously... |
Forum: Python Jun 12th, 2008 |
| Replies: 127 Views: 47,629 To get used to wxPython, I took vegaseat's mortgage calculator snippet written in Csharp and converted it to Python. I was surprised how easy it was:
# a simple mortgage calulator using wxPython
#... |
Forum: Python May 27th, 2008 |
| Replies: 16 Views: 3,953 You might have to uninstall a partially installed version of eric before reinstalling. I would stick with an IDE that uses wxPython as its GUI toolkit, like DrPython, Boa or PythonWin. |
Forum: Python May 26th, 2008 |
| Replies: 209 Views: 97,932 Some Python riddles. Try to figure out the possible results:
print max(max('hello', 'world'))
print [1] * 5
q = zip(range(3), 'abc')
t1, t2 = zip(*q)
print q
print t1
print t2 |
Forum: Python May 15th, 2008 |
| Replies: 2 Views: 406 You can use Python as a scripting language for HTML code similar to javascript, but the server has to allow it. |
Forum: Python May 5th, 2008 |
| Replies: 2 Views: 483 Shouldn't that be:
if pow(y, 2) == (pow(x, 3)+(b*x)+(c % p)):
It also pays to test-print some interim results. |
Forum: Python May 2nd, 2008 |
| Replies: 4 Views: 2,355 The strip() function only removes leading and trailing characters:
text = 'goodbye! cruel, harsh world!..?'
print text.strip('!,.?') # goodbye! cruel, harsh world
To remove characters all through... |
Forum: Python Apr 19th, 2008 |
| Replies: 5 Views: 749 Interesting, what module would you use to play each sound object? |
Forum: Python Feb 28th, 2008 |
| Replies: 2 Views: 1,356 This is what our instructor gave as for a wxPython toolbar example:
# wx.ToolBar(parent, id, pos, size, style, name)
# images from DrPython\bitmaps\16\
import wx
class MyToolBar(wx.Frame):
... |
Forum: Python Feb 28th, 2008 |
| Replies: 2 Views: 1,356 You got to use code tags around your code!
http://www.daniweb.com/forums/announcement114-3.html |
Forum: Python Feb 28th, 2008 |
| Replies: 1 Views: 597 Looks like an older version or wrapper of Tkinter with little documentation:
http://tkinter.unpythonic.net/wiki/BWidgets |
Forum: Python Feb 28th, 2008 |
| Replies: 2 Views: 426 This is a way to do it without slicing:
# separate words with alternating 2 and 3 spaces
# simply alternate between odd and even count
s = 'one two three four five'
space = " "
new = ""... |
Forum: Python Feb 25th, 2008 |
| Replies: 5 Views: 653 I think Google will be your friend. They use a lot of Python themselves. That's where I would look first.
By the way, what kind of language are you speaking, I know it's not English. |
Forum: Python Feb 25th, 2008 |
| Replies: 3 Views: 601 This is something similar to what you coded. I didn't use the 'clear the screen' thingy because that would make it OS specific, and our instructor says that it is better to leave a record on the... |
Forum: Python Feb 6th, 2008 |
| Replies: 10 Views: 2,921 Thanks G-Do, we were told by our instructor to always use split(None) rather than just split(). I imagine it is just style. |
Forum: Python Feb 5th, 2008 |
| Replies: 10 Views: 2,921 I am not sure where you get that stdin notion from? Python has its own functions for input and file handling:
# write a test text file
jingle = """Dashing through the snow
In a one horse open... |