For your calculator project I would use wxPython. You could use the form builder that comes with Boa Constructor, or you could easily make your own layout of the buttons and the textbox for the result.
Below is just a little example how to get started with a calculator frame ...
# Template of a wxPython Frame with 2 buttons and textbox
# could be the start of a calculator
import wx
class MyFrame(wx.Frame):
"""make a frame, inherits wx.Frame"""
def __init__(self):
# create a frame/window, no parent, default to wxID_ANY or -1
wx.Frame.__init__(self, None, wx.ID_ANY, 'wxPython', pos=(300, 150), size=(220, 200))
self.SetBackgroundColour('green')
self.edit1 = wx.TextCtrl(self, -1, value="", pos=(5,5), size=(200, 25))
self.button1 = wx.Button(self, -1, label='1', pos=(5, 130), size=(20, 20))
self.button1.Bind(wx.EVT_BUTTON, self.button1Click, self.button1)
self.button2 = wx.Button(self, -1, label='2', pos=(30, 130), size=(20, 20))
self.button2.Bind(wx.EVT_BUTTON, self.button2Click, self.button2)
# copy and paste more buttons here ...
# show the frame
self.Show(True)
def button1Click(self,event):
txt = self.edit1.GetValue()
txt = txt + '1'
self.edit1.SetValue(txt)
def button2Click(self,event):
txt = self.edit1.GetValue()
txt = txt + '2'
self.edit1.SetValue(txt)
# add more defines ...
application = wx.PySimpleApp()
# call class MyFrame
window = MyFrame()
# start the event loop
application.MainLoop()
Copy and paste will be easy, just position the buttons at the right place. Eventually you have to parse what is in the textbox and do your calculation, that is the hard part!
Note: php code tags used to work well in the early days of DaniWeb, now they don't. Replaced them with the newer tags.