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  
Smartphone Development  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Mobile Linux  
App Generation ROI  
IBM® developerWorks  
Forums Sitemap  
E-Commerce Hosting  
Linux Web Hosting  
Managed Hosting  
Small Business Hosting  
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? 
Google.com  
PYTHON

Designing a Calculator in wxPython
By: Peyton McCullough
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: starstarstarstarstar / 15
    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:
      error-file:tidyout.log Del.ici.ous error-file:tidyout.log Digg
      error-file:tidyout.log Blink error-file:tidyout.log Simpy
      error-file:tidyout.log Google error-file:tidyout.log Spurl
      error-file:tidyout.log Y! MyWeb error-file:tidyout.log 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


    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
     

       

    PYTHON ARTICLES

    - Tuples and Other Python Object Types
    - The Dictionary Python Object Type
    - String and List Python Object Types
    - Introducing Python Object Types
    - Mobile Programming using PyS60: Advanced UI ...
    - Nested Functions in Python
    - Python Parameters, Functions and Arguments
    - Python Statements and Functions
    - Statements and Iterators in Python
    - Sequences and Sets in Python
    - Python Expressions and Operators
    - Dictionaries, Variables and Statements in Py...
    - Data Types in Python
    - The Python Language
    - SSH with Twisted





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek