SunQuest
 
       Python
  Home arrow Python arrow Page 2 - Designing a Calculator in wxPython
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Actuate Whitepapers 
VeriSign Whitepapers 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PYTHON

Designing a Calculator in wxPython
By: Peyton McCullough
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 14
    2005-07-13

    Table of Contents:
  • Designing a Calculator in wxPython
  • The Plan
  • Creating the Layout
  • Wiring It All Together

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Designing a Calculator in wxPython - The Plan


    (Page 2 of 4 )

    The best way to organize our calculator is to use a wxGridBagSizer. Our buttons will almost be the same size and will be organized in rows and columns, so a wxGridBagSizer is perfect for the job. The wxGridBagSizer is also pretty simple to use, so that's another plus.

    Our calculator isn't going to be very complex, as I mentioned before. On the first row of our calculator will be the display, which will be served by a read-only wxTextCtrl. The display will take up the entire row. The second row will contain the add to memory button, a button for the number one, a button for the number two, a button for the number three and an addition button. The third row will contain a delete from memory button, a button for the number four, a button for the number five, a button for the number six and a subtraction button. The fourth row will contain a memory recall button, a button for the number seven, a button for the number eight, a button for the number nine and a multiplication button. The fifth row will contain a wxStaticText that displays the number currently in memory, a decimal button, a zero button, a solve button and a division button. The final row will contain a two-column clear button, a backspace button, a positive/negative button and a square root button.

    We'll save ourselves the pain of creating over a dozen methods by making use of event ID numbers. I'll show you how to do this once we're at that point.

    Let's get to it.

    More Python Articles
    More By Peyton McCullough


       · Not sure if I missed it, but it would be nice to see the final piece.
       · Hey, great article. I'm really enjoying the wxpython progression, and I think it...
     

       

    PYTHON ARTICLES

    - SSH with Twisted
    - Mobile Programming in Python using PyS60: UI...
    - Python: Count on It
    - Python Strings: Spinning Yarns
    - Python: More Fun with Strings
    - Python: Stringing You Along
    - Python Operators
    - Bluetooth Programming in Python: Network Pro...
    - Python Sets
    - Python Conditionals, Lists, Dictionaries, an...
    - Python: Input and Variables
    - Introduction to Python Programming
    - Mobile Programming in Python using PyS60: Ge...
    - Bluetooth Programming using Python
    - Finishing the PyMailGUI Client: User Help To...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway