Search Results

Showing results 1 to 40 of 1000
Search took 0.08 seconds.
Search: Posts Made By: bumsfeld
Forum: Python 1 Day Ago
Replies: 75
Views: 13,614
Posted By bumsfeld
Here is modified (also added needed delay) and commented code from the pygame tutorial that shows how to load one image onto rectangle object and move the object:
# use pygame to bounce/move loaded...
Forum: Python 2 Days Ago
Replies: 7
Views: 147
Posted By bumsfeld
If you use m==0 it will give you False unless m is zero.
Forum: Python 2 Days Ago
Replies: 5
Views: 159
Posted By bumsfeld
You can create myarray[x][y][z], but you still have to associate with the sphere object, that is where the dictionary mapping comes in handy.
Forum: Python 2 Days Ago
Replies: 5
Views: 159
Posted By bumsfeld
You can include coordinate z into your key tuple by simply expanding vegaseat's code:
# create a large number of spheres referencing them
# with a (x, y, z):sphere_object dictionary pair

import...
Forum: Python 2 Days Ago
Replies: 3
Views: 154
Posted By bumsfeld
Your area formula for regular polygons should be:

area = ((length**2) * numSides)/(4 * (math.tan(math.pi/numSides)))
Your result will be square units of whatever units of measurement your sides...
Forum: Python 2 Days Ago
Replies: 2
Views: 131
Posted By bumsfeld
Vegaseat left this ttk code somewhere showing you the way module ttk should be imported and applied:
# exploring the Tkinter expansion module ttk notebook
# tested with Python 3.1 and Tkinter 8.5 ...
Forum: Python 2 Days Ago
Replies: 3
Views: 134
Posted By bumsfeld
Be aware that Python25 and Python26 use different MS C compilers and so do the modules they use. The C code syntax has to match these compilers, as they are not compatible.
Forum: Python 2 Days Ago
Replies: 7
Views: 147
Posted By bumsfeld
Looking at your code you have quite a nightmare of errors in there and on top of that the all important indentations are all screwed up.

!) use the customary 4 space indentations, avoid tabs!!!!
...
Forum: Python 7 Days Ago
Replies: 2
Solved: GetBestSize()??
Views: 160
Posted By bumsfeld
Try self.SetSizerAndFit(sizer)
Forum: Geeks' Lounge 7 Days Ago
Replies: 50
Views: 2,196
Posted By bumsfeld
So, what good anti-virus programs are out for Windows 7?
Forum: Geeks' Lounge 7 Days Ago
Replies: 6
Views: 337
Posted By bumsfeld
Should be at least 1 kilometer in diameter before it's worth one Hollywood movie!
Forum: Geeks' Lounge 7 Days Ago
Replies: 1,376
Views: 146,716
Posted By bumsfeld
I agree!

Alaska pollock with zucchini and wild rice. Will have M&Ms for dessert.
Forum: Geeks' Lounge 7 Days Ago
Replies: 21
Views: 626
Posted By bumsfeld
You know you are complete computer geek when you like Google's new language Go.
Forum: Geeks' Lounge 7 Days Ago
Replies: 143
Views: 8,842
Posted By bumsfeld
It is better to die for something than to live for nothing.
-- George S. Patton (US Army)
Forum: Python 7 Days Ago
Replies: 5
Views: 212
Posted By bumsfeld
Are you usng Python2 or Python3?
Are your positive numbers integers or floats?
Forum: Python 7 Days Ago
Replies: 4
Views: 140
Posted By bumsfeld
Why so complicated?
Using a similar english dictionary file:
# mydict.txt has one English word per line
# about 74500 in total
mydict = open("mydict.txt", "r").readlines()

print(mydict[:10])...
Forum: Python 7 Days Ago
Replies: 11
Views: 359
Posted By bumsfeld
The reason you want to make something private to the class is to keep it from easily spilling out into external code. So pseudo-private will do one good job. Remember it's called private, not...
Forum: Python 31 Days Ago
Replies: 12
Views: 596
Posted By bumsfeld
import os
# works on windows nt (also xp and vista) or linux
os.system(['clear','cls'][os.name == 'nt'])
If [os.name == 'nt'] is True then this becomes effectively 1. So it picks item at index 1...
Forum: Python 31 Days Ago
Replies: 9
Views: 288
Posted By bumsfeld
Read vegaseat's comment:


You need to move all those lines to the right by 4 spaces.
Forum: Python 31 Days Ago
Replies: 3
Views: 363
Posted By bumsfeld
You may not want to add letters to the list that have zero count.
Forum: Python 31 Days Ago
Replies: 7
Solved: python 2. to 3
Views: 261
Posted By bumsfeld
Also with Python3 you don't have to use
fahrenheit = (9.0 / 5.0) * celsius + 32
you can just use
fahrenheit = (9 / 5) * celsius + 32
since '/' is now floating point division and '//' is integer...
Forum: Python 31 Days Ago
Replies: 3
Views: 639
Posted By bumsfeld
If you are curious, also check this out:
http://www.daniweb.com/code/snippet216539.html
Forum: Python 31 Days Ago
Replies: 9
Views: 288
Posted By bumsfeld
Did you download the code or retype it manually yourself?
There are some errors due to indentations and typos.

The return outside function error is really indentation error!
Forum: Python 31 Days Ago
Replies: 4
Views: 3,084
Posted By bumsfeld
Seems to me that you also have to consider the time that re.compile() needs.
Forum: Python 32 Days Ago
Replies: 5
Views: 345
Posted By bumsfeld
Some corrections:
num = 0
mylist = []

while num < 10:
num = num + 1
mylist.append(num)

print(mylist)
Forum: Python 32 Days Ago
Replies: 4
Solved: Ipart - Fpart
Views: 219
Posted By bumsfeld
Asking questions is never stupid! :)
Forum: Python 32 Days Ago
Replies: 3
Solved: numtolet
Views: 175
Posted By bumsfeld
This will also trap number exceeding the index:
import string

def numtolet(num):
if num > 25: return
return string.ascii_uppercase[num]

print( numtolet(0) ) # A
print( numtolet(5)...
Forum: Python 33 Days Ago
Replies: 6
Views: 287
Posted By bumsfeld
# staticmethod() and classmethod()
# make it easier to call one class method

class ClassA(object):
def test(this):
print this
test = staticmethod(test)

ClassA.test(4) # 4
Forum: Python 33 Days Ago
Replies: 8
Solved: List help...
Views: 205
Posted By bumsfeld
One of the solutions is pretty straight forward, with easy logic:
list1 = [[1,2,3],[4,5,6],[7,8,9],[10,11,12]]
list2 = [1,2,3,4,11]

list3 = []
# q1 is each sublist in list1
for q1 in list1:
...
Forum: Geeks' Lounge Oct 12th, 2009
Replies: 1,376
Views: 146,716
Posted By bumsfeld
Can Halloween be far away?
I like apple dumplings and fritters! Apple cider only if it's hard cider.
Forum: Python Oct 12th, 2009
Replies: 5
Views: 392
Posted By bumsfeld
As performance is concerned, the file read from disk will be the slowest part by far!
Forum: Python Oct 12th, 2009
Replies: 5
Views: 6,778
Posted By bumsfeld
Do you mean highest frequency first?

Simply add this to the end of the code:
print '-'*30

print "sorted by highest frequency first:"
# create list of (val, key) tuple pairs
freq_list2 =...
Forum: Python Oct 12th, 2009
Replies: 3
Views: 367
Posted By bumsfeld
You are close:
fname = raw_input("enter a text file name: ")

fread = open(fname, "r")
# read the whole file into one string
text = fread.read()
fread.close()

# split the whole text string...
Forum: Python Oct 12th, 2009
Replies: 22
Views: 177,639
Posted By bumsfeld
Vary bad manners to hijack this thread for such question.

Start your own thread and give more info!
Forum: Python Oct 12th, 2009
Replies: 5
Views: 1,036
Posted By bumsfeld
You are in the wrong forum. Many of us went away from low level C to high level Python to solve such problems easily.
Forum: Python Oct 12th, 2009
Replies: 5
Views: 1,612
Posted By bumsfeld
However, pyHook and pythoncom work only on Windows systems. Not too bad, since most computers in this world are using Windows. Tkinter is more cross-platform for the few odd folks that user other...
Forum: Python Oct 11th, 2009
Replies: 7
Views: 288
Posted By bumsfeld
Similar to jice's code:
# simply ignore index zero
pos = [' '] * 11
print( pos )

POS = 1

pos[POS] = '->'
print( pos )
Forum: Geeks' Lounge Oct 11th, 2009
Replies: 1,376
Views: 146,716
Posted By bumsfeld
Toasted plain bagel with lots of butter and fresh cup of black tea.
Forum: Geeks' Lounge Oct 11th, 2009
Replies: 58
Views: 3,080
Posted By bumsfeld
I think this is correct, because as my father explained to me, in those days C compilers had the inline assembly language option. This allowed access to the very low levels of the computer chips.
Forum: C Oct 5th, 2009
Replies: 5
Views: 255
Posted By bumsfeld
What are you going to do to the user after 3 tries?
Showing results 1 to 40 of 1000

 


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

©2003 - 2009 DaniWeb® LLC