Search Results

Showing results 1 to 40 of 167
Search took 0.02 seconds.
Search: Posts Made By: bumsfeld ; Forum: Python and child forums
Forum: Python 30 Days Ago
Replies: 5
Views: 313
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 30 Days Ago
Replies: 5
Views: 313
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 30 Days Ago
Replies: 3
Views: 311
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 30 Days Ago
Replies: 3
Solved: pcap help
Views: 282
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 Nov 13th, 2009
Replies: 2
Solved: GetBestSize()??
Views: 213
Posted By bumsfeld
Try self.SetSizerAndFit(sizer)
Forum: Python Nov 13th, 2009
Replies: 5
Views: 348
Posted By bumsfeld
Are you usng Python2 or Python3?
Are your positive numbers integers or floats?
Forum: Python Nov 13th, 2009
Replies: 4
Views: 211
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 Nov 13th, 2009
Replies: 11
Views: 539
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 Oct 20th, 2009
Replies: 7
Solved: python 2. to 3
Views: 294
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 Oct 19th, 2009
Replies: 6
Views: 332
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 Oct 19th, 2009
Replies: 8
Solved: List help...
Views: 225
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: Python Oct 12th, 2009
Replies: 22
Views: 185,231
Posted By bumsfeld
Vary bad manners to hijack this thread for such question.

Start your own thread and give more info!
Forum: Python Oct 11th, 2009
Replies: 7
Views: 320
Posted By bumsfeld
Similar to jice's code:
# simply ignore index zero
pos = [' '] * 11
print( pos )

POS = 1

pos[POS] = '->'
print( pos )
Forum: Python Oct 5th, 2009
Replies: 6
Solved: python help
Views: 272
Posted By bumsfeld
At least for some time, it would be very nice if people indicated which version of Python they are using.
Forum: Python Aug 27th, 2009
Replies: 6
Views: 478
Posted By bumsfeld
Extension .pyd is used for C compiled library files for Python.
Forum: Python Aug 22nd, 2009
Replies: 3
Views: 308
Posted By bumsfeld
I would say yes, unless your Operating System uses disk space as virtual memory.
Forum: Python Aug 22nd, 2009
Replies: 12
Views: 1,385
Posted By bumsfeld
One rude awakening with Python3 will be the frequent use of bytearrays instead of strings. It does this to handle international unicode better.

Here is how you deal with this:
# get code of...
Forum: Python Aug 22nd, 2009
Replies: 4
Views: 942
Posted By bumsfeld
Also the online book "dive into python" has been mostly
rewritten for Python3 (check appendix A for 2to3 diffs):
http://diveintopython3.org/
Forum: Python Aug 22nd, 2009
Replies: 4
Views: 942
Posted By bumsfeld
Swaroop C.H. has rewritten his excellent beginning Python tutorial for Python3:
http://www.swaroopch.com/notes/Python_en:Table_of_Contents
Forum: Python Aug 13th, 2009
Replies: 4
Views: 309
Posted By bumsfeld
There is example at:
http://www.daniweb.com/forums/showpost.php?p=947978&postcount=46
that might work.
Forum: Python Aug 5th, 2009
Replies: 7
Views: 470
Posted By bumsfeld
I like wxPython. However, if you use the newer Python 3.1, it could take long time for wxPython to be available. So now I am learning PyQT.

Again, Tkinter isn't bad to learn in the beginning,...
Forum: Python Jul 30th, 2009
Replies: 2
Solved: Python Input
Views: 443
Posted By bumsfeld
Function raw_input() would force the user to type in the entire XML code. I don't think you want this.

Normally the XML code would come from file, something like this:
fin = open("Myxml.xml",...
Forum: Python Jul 30th, 2009
Replies: 14
Views: 437
Posted By bumsfeld
You got the right idea, but if you insist on recursion, you have to follow certain rules:
#s=raw_input("Enter a number to simplify: ")
s = '123456789' # for test

def loop(s, p=0):
for i in...
Forum: Python Jul 29th, 2009
Replies: 3
Views: 316
Posted By bumsfeld
You can use 32x32 Windows .bmp file instead of .ico file.
Forum: Python Jul 29th, 2009
Replies: 14
Views: 437
Posted By bumsfeld
Hint, in while loop turn the number string into list of individual digits and sum the list until the sum is less than 10, then break.

Careful here, you are using strings(characters) and integers. ...
Forum: Python Jul 25th, 2009
Replies: 3
Views: 360
Posted By bumsfeld
I have Python2.5.4 and Python3.1 working on the same XP machine.
Programming editors (IDE) like IDLE may have to be convinced with batch file to use the correct Python version.

Here is example:...
Forum: Python Jul 19th, 2009
Replies: 4
Solved: tkinter layout
Views: 405
Posted By bumsfeld
Only potential problem with place() is, that it does not resize with window.
Forum: Python Jul 19th, 2009
Replies: 14
Views: 559
Posted By bumsfeld
The Tkinter GUI toolkit has data input dialogs that will validate your input, as shown here:
# Python GUI toolkit Tkinter has three different data input dialogs:
# tkSimpleDialog.askstring(title,...
Forum: Python Jul 19th, 2009
Replies: 4
Solved: tkinter layout
Views: 405
Posted By bumsfeld
Yes, instead of using geometry manager pack() or grid(), use place(x, y) for layouts. Note that place(x, y) is absolute, and coordinates x or y can go negative to shift the widget out off the...
Forum: Python Jul 19th, 2009
Replies: 4
Views: 181
Posted By bumsfeld
You can use this:
mylist = [
[1, 9, 22, 28, 0.69887889000000003, 0.98993399999999998, 2],
[4, 27, 6, 22, 0.81186093999999998, 1.1221458099999999, 2],
[4, 27, 100, 30, 0.74796748000000002,...
Forum: Python Apr 18th, 2009
Replies: 6
Views: 370
Posted By bumsfeld
Pick your project and use C++ to write your code. There will be the time that is rather obvious when you want to switch to Python.
Forum: Python Apr 13th, 2009
Replies: 3
Solved: Odd Error
Views: 340
Posted By bumsfeld
Python version 3.0 has modernized the language and much of the old code examples will not work. You can use a little utility program called 2to3.py to change old syntax to new syntax.
Forum: Python Oct 17th, 2008
Replies: 4
Solved: Progress Bar
Views: 695
Posted By bumsfeld
This perhaps shows how you can do this:
http://www.daniweb.com/forums/showpost.php?p=714874&postcount=100
Forum: Python Sep 22nd, 2008
Replies: 6
Views: 780
Posted By bumsfeld
There is usually info in the MS-HTML-Help file
wx.chm
if wxPython does not have one particular feature.

Also look at:
http://wiki.wxpython.org/index.cgi/FrontPage
This is the API ref, very...
Forum: Python Sep 21st, 2008
Replies: 14
Views: 1,770
Posted By bumsfeld
As far as I understand, steganography would be to change each byte of image file just one small amount, so the picture essentially looks the same. Comparing it with the original picture would reveal...
Forum: Python Sep 21st, 2008
Replies: 4
Views: 483
Posted By bumsfeld
Something like this will do:
for line in wordlistfile:
wordlist.append(line.strip())
Forum: Python Aug 26th, 2008
Replies: 9
Views: 2,252
Posted By bumsfeld
Simply use this:

# list all the modules Python currently knows about ...
help("modules")
Forum: Python Aug 26th, 2008
Replies: 2
Solved: comparing lists
Views: 582
Posted By bumsfeld
At first blush i would say this might do:
# compare these two list set and convert
# w_b into [0.5, 0, 0.5, 0]

a = ['a', 'b', 'c', 'd']
w_a = [0.25, 0.25, 0.25, 0.25]

b = ['a', 'c']
w_b =...
Forum: Python Aug 15th, 2008
Replies: 10
Solved: extra string
Views: 1,121
Posted By bumsfeld
Proof that [::-1] works for spelling string in reverse:
s1 = "racecar"
s2 = "kayak"

print s1, s1[::-1]
print s2, s2[::-1]

:)
Forum: Python Aug 15th, 2008
Replies: 6
Solved: module location
Views: 613
Posted By bumsfeld
Functions sort() and sorted() reside in the core of the Python interpreter which is written in C and compiled. On Windows the Python core is for instance in the dynamic link library called...
Showing results 1 to 40 of 167

 


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

©2003 - 2009 DaniWeb® LLC