Search Results

Showing results 1 to 40 of 74
Search took 0.01 seconds.
Search: Posts Made By: Lardmeister ; Forum: Python and child forums
Forum: Python 11 Hours Ago
Replies: 3
Views: 151
Posted By Lardmeister
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
Posted By Lardmeister
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
Posted By Lardmeister
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
Posted By Lardmeister
Use either Tkinter.END or 'end'
Forum: Python Jul 2nd, 2009
Replies: 12
Views: 624
Posted By Lardmeister
Thanks for the info jlm699!
Forum: Python Jul 2nd, 2009
Replies: 12
Views: 624
Posted By Lardmeister
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
Solved: wxPython Error
Views: 504
Posted By Lardmeister
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
Solved: A little help
Views: 276
Posted By Lardmeister
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
Solved: unicode riddle
Views: 352
Posted By Lardmeister
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
Posted By Lardmeister
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
Posted By Lardmeister
You could use / both Windows and Unix allow that.
Forum: Python Jul 1st, 2009
Replies: 14
Views: 437
Posted By Lardmeister
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
Solved: wxPython Error
Views: 504
Posted By Lardmeister
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
Posted By Lardmeister
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
Posted By Lardmeister
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
Posted By Lardmeister
Works fine for me. What is your total error message?
Forum: Python Oct 29th, 2008
Replies: 4
Views: 517
Posted By Lardmeister
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
Posted By Lardmeister
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
Posted By Lardmeister
Try this:

num = [1,2,3,4,5,6]
print sum(num)
Forum: Python Sep 16th, 2008
Replies: 12
Views: 3,857
Posted By Lardmeister
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
Posted By Lardmeister
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
Posted By Lardmeister
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
Solved: extra string
Views: 1,109
Posted By Lardmeister
Oh yeah, like:
print 'racecar' == 'racecar'[::-1] # True
:)
Forum: Python Jun 20th, 2008
Replies: 2
Views: 691
Posted By Lardmeister
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
Posted By Lardmeister
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
Posted By Lardmeister
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
Solved: ERIC Ide
Views: 3,953
Posted By Lardmeister
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
Posted By Lardmeister
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
Posted By Lardmeister
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
Posted By Lardmeister
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
Posted By Lardmeister
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
Posted By Lardmeister
Interesting, what module would you use to play each sound object?
Forum: Python Feb 28th, 2008
Replies: 2
Views: 1,356
Posted By Lardmeister
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
Posted By Lardmeister
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
Posted By Lardmeister
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
Posted By Lardmeister
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
Posted By Lardmeister
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
Posted By Lardmeister
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
Posted By Lardmeister
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
Posted By Lardmeister
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...
Showing results 1 to 40 of 74

 


About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC