Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jul 7th, 2006, 2:50 PM   #11
andro
Professional Programmer
 
Join Date: Oct 2005
Location: California
Posts: 311
Rep Power: 3 andro is on a distinguished road
Send a message via AIM to andro
Very nice DaWei
andro is offline   Reply With Quote
Old Jul 7th, 2006, 2:58 PM   #12
andro
Professional Programmer
 
Join Date: Oct 2005
Location: California
Posts: 311
Rep Power: 3 andro is on a distinguished road
Send a message via AIM to andro
For some reason I can't type in "40" in the Gear Size box. It turns to 4.0 every time. I have to move over and delete the decimal manually to get 40. Ditto for the other boxes, with other numbers.
andro is offline   Reply With Quote
Old Jul 7th, 2006, 3:12 PM   #13
Zap
Guest
 
Posts: n/a
I just compiled it... It's awesome. I didn't know you could do api so easily in phython! I might just take up this language. You can do straight windows programming in it, right?? BTW, does phython hav I.D.E.s?
  Reply With Quote
Old Jul 7th, 2006, 3:16 PM   #14
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
And what do you define as "straight windows programming"?? Boa Constructor, which I used, is an IDE. You won't be able to use it to modify the widgets/window of my code, because I hand edited the controls class.

@ Andro: I should have used more time for the text boxes, modularized and regularized their use and interaction with the sliders, but I didn't. I pick up on the event for each change and enforce limits on the fly, instead of throwing out the last character and just boomping at the user. My initial thought was to allow more granularity through the boxes than one gets from the slider. I just didn't take time to really follow through. I don't even bother to keep the cursor in a reasonable place. I also didn't take time to allow for a greater number of samples per revolution. Larger patterns will approach a sparseness that results in a very dim output.

Incidentally, the gear and marker size numbers represent a percentage of the track gear radius. The zoom percentage relates the track gear radius to the panel width and is applied to all components simultaneously, upon adjustment and prior to the spin.

The other dirty thing is the blocking nature of the plot. I should have used a timer and messages. Oh well. No guarantees, it might smoke your system. Although there isn't an antifreeze variable, if your dog eats it, he may die.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers

Last edited by DaWei; Jul 7th, 2006 at 3:27 PM.
DaWei is offline   Reply With Quote
Old Jul 8th, 2006, 1:29 AM   #15
Soulstorm
Hobbyist Programmer
 
Soulstorm's Avatar
 
Join Date: Jan 2006
Location: Menidi, Athens, Greece
Posts: 243
Rep Power: 3 Soulstorm is on a distinguished road
Very nice, DaWei. Perhaps I will try and do that in Cocoa someday...!
__________________
Project::Soulstorm (personal homepage)
Soulstorm is offline   Reply With Quote
Old Jul 8th, 2006, 2:08 AM   #16
Toro
Hobbyist Programmer
 
Toro's Avatar
 
Join Date: Apr 2006
Posts: 136
Rep Power: 0 Toro is an unknown quantity at this point
Great job, DaWei!
Toro is offline   Reply With Quote
Old Jul 8th, 2006, 10:57 AM   #17
Jessehk
The Oblivious One
 
Jessehk's Avatar
 
Join Date: May 2005
Location: Ontario, Canada
Posts: 644
Rep Power: 4 Jessehk is on a distinguished road
$ python SpiroApp.py
Traceback (most recent call last):
  File "/home/jesse/downloads/Spiro.zip_FILES/Spiro.py", line 490, in OnScaleBoxText
    self.setScale (True)
  File "/home/jesse/downloads/Spiro.zip_FILES/Spiro.py", line 359, in setScale
    self.rescale ()
  File "/home/jesse/downloads/Spiro.zip_FILES/Spiro.py", line 310, in rescale
    self.marker.draw (dc, 0, self.insideBox.IsChecked (), True)
  File "/home/jesse/downloads/Spiro.zip_FILES/Spiro.py", line 70, in draw
    mQ = mR/self.gear.radius
ZeroDivisionError: float division
Traceback (most recent call last):
  File "/home/jesse/downloads/Spiro.zip_FILES/Spiro.py", line 466, in OnSizeBoxText
    self.setCircleSize (True)
  File "/home/jesse/downloads/Spiro.zip_FILES/Spiro.py", line 394, in setCircleSize
    self.rescale ()
  File "/home/jesse/downloads/Spiro.zip_FILES/Spiro.py", line 310, in rescale
    self.marker.draw (dc, 0, self.insideBox.IsChecked (), True)
  File "/home/jesse/downloads/Spiro.zip_FILES/Spiro.py", line 70, in draw
    mQ = mR/self.gear.radius
ZeroDivisionError: integer division or modulo by zero
Traceback (most recent call last):
  File "/home/jesse/downloads/Spiro.zip_FILES/Spiro.py", line 474, in OnMarkerBoxText
    self.setMarkerSize (True)
  File "/home/jesse/downloads/Spiro.zip_FILES/Spiro.py", line 331, in setMarkerSize
    self.rescale ()
  File "/home/jesse/downloads/Spiro.zip_FILES/Spiro.py", line 310, in rescale
    self.marker.draw (dc, 0, self.insideBox.IsChecked (), True)
  File "/home/jesse/downloads/Spiro.zip_FILES/Spiro.py", line 70, in draw
    mQ = mR/self.gear.radius
ZeroDivisionError: integer division or modulo by zero
Traceback (most recent call last):
  File "/home/jesse/downloads/Spiro.zip_FILES/Spiro.py", line 482, in OnRotBoxText
    self.setRotations (True)
  File "/home/jesse/downloads/Spiro.zip_FILES/Spiro.py", line 364, in setRotations
    self.rescale ()
  File "/home/jesse/downloads/Spiro.zip_FILES/Spiro.py", line 310, in rescale
    self.marker.draw (dc, 0, self.insideBox.IsChecked (), True)
  File "/home/jesse/downloads/Spiro.zip_FILES/Spiro.py", line 70, in draw
    mQ = mR/self.gear.radius
ZeroDivisionError: integer division or modulo by zero
Traceback (most recent call last):
  File "SpiroApp.py", line 20, in ?
    main()
  File "SpiroApp.py", line 16, in main
    application = BoaApp(0)
  File "/usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/_core.py", line 7473, in __init__
    self._BootstrapApp()
  File "/usr/lib/python2.4/site-packages/wx-2.6-gtk2-unicode/wx/_core.py", line 7125, in _BootstrapApp
    return _core_.PyApp__BootstrapApp(*args, **kwargs)
  File "SpiroApp.py", line 11, in OnInit
    self.main.OnInit ()
  File "/home/jesse/downloads/Spiro.zip_FILES/Spiro.py", line 263, in OnInit
    self.marker.draw (dc, 0, self.insideBox.IsChecked (), True)
  File "/home/jesse/downloads/Spiro.zip_FILES/Spiro.py", line 70, in draw
    mQ = mR/self.gear.radius
ZeroDivisionError: integer division or modulo by zero
__________________
Dr. Zoidberg: [ecstatic] I'm going to a movie... with FRIENDS!
Jessehk is offline   Reply With Quote
Old Jul 8th, 2006, 11:16 AM   #18
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Patient: "Doc, my penis hurts when I catch it in my zipper. What do you recommend?"

Doctor: "Don't DO that."

Just kidding. See my comments to Andro regarding input limitations and problems. Inasmuch as this was a spontaneous response to the lack of takers (people who ASKED for something to do), and not a commercial proposition, I don't plan to fix it. I maintain that it's cute while standing by my warning that it may kill your dog.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Jul 8th, 2006, 11:18 AM   #19
MisterPoppy
Newbie
 
Join Date: Apr 2006
Location: Sweden
Posts: 13
Rep Power: 0 MisterPoppy is on a distinguished road
I got

"ImportError: No module with the name wx found" or something.
MisterPoppy is offline   Reply With Quote
Old Jul 8th, 2006, 11:22 AM   #20
Jessehk
The Oblivious One
 
Jessehk's Avatar
 
Join Date: May 2005
Location: Ontario, Canada
Posts: 644
Rep Power: 4 Jessehk is on a distinguished road
Quote:
Originally Posted by MisterPoppy
I got

"ImportError: No module with the name wx found" or something.
You have to install wxwidgets for python. If you use Ubuntu (maybe you do),

just run:

sudo aptitute update
sudo aptitude install python-wx
__________________
Dr. Zoidberg: [ecstatic] I'm going to a movie... with FRIENDS!
Jessehk is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 11:31 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC