User talk:Kenjone


 * 1) !/usr/bin/python


 * 1) calcdb.py

import wx

value = '' value2 = ''

class Calculator(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(300, 250))

menubar = wx.MenuBar file = wx.Menu file.Append(1, '&Quit', 'Exit Calculator') menubar.Append(file, '&File') self.SetMenuBar(menubar)

self.Bind(wx.EVT_MENU, self.OnClose, id=1) self.Bind(wx.EVT_BUTTON, self.OnClickNumbers) self.Bind(wx.EVT_BUTTON, self.OnClear, id=2) self.Bind(wx.EVT_BUTTON, self.OnClose, id=3) #self.Bind(wx.EVT_BUTTON, self.OnAbsolute, id = 3) #self.Bind(wx.EVT_BUTTON, self.OnClickOperator)

sizer = wx.BoxSizer(wx.VERTICAL) self.display = wx.TextCtrl(self, -1, '', style=wx.TE_RIGHT) #self.display = wx.ComboBox(self, -1, '', style=wx.TE_RIGHT)

sizer.Add(self.display, 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 4) gs = wx.GridSizer(4, 4, 3, 3)

gs.AddMany( [           (wx.Button(self, -1, 'Absolute'), 0, wx.EXPAND),            (wx.StaticText(self, -1, ''), 0, wx.EXPAND),            (wx.Button(self, 2, 'Clear'), 0, wx.EXPAND),            (wx.Button(self, 3, 'Close'), 0, wx.EXPAND),            (wx.Button(self, -1, '7'), 0, wx.EXPAND),            (wx.Button(self, -1, '8'), 0, wx.EXPAND),            (wx.Button(self, -1, '9'), 0, wx.EXPAND),            (wx.Button(self, -1, '/'), 0, wx.EXPAND),            (wx.Button(self, -1, '4'), 0, wx.EXPAND),            (wx.Button(self, -1, '5'), 0, wx.EXPAND),            (wx.Button(self, -1, '6'), 0, wx.EXPAND),            (wx.Button(self, -1, '*'), 0, wx.EXPAND),            (wx.Button(self, -1, '1'), 0, wx.EXPAND),            (wx.Button(self, -1, '2'), 0, wx.EXPAND),            (wx.Button(self, -1, '3'), 0, wx.EXPAND),            (wx.Button(self, -1, '-'), 0, wx.EXPAND),            (wx.Button(self, -1, '0'), 0, wx.EXPAND), (wx.Button(self, -1, '.'), 0, wx.EXPAND), (wx.Button(self, -1, '='), 0, wx.EXPAND), (wx.Button(self, -1, '+'), 0, wx.EXPAND) ])

sizer.Add(gs, 1, wx.EXPAND) self.SetSizer(sizer) self.Centre self.Show(True)

def OnClose(self, event): self.Close

def OnClear(self, event): self.display.SetValue("") def OnClickNumbers(self, event):

label = event.GetEventObject.GetLabel #getId = event.GetEventObject.GetId

if label == "1": value = self.display.GetValue value = value + '1' self.display.SetValue(value) elif label == "2": value = self.display.GetValue value = value + '2' self.display.SetValue(value)

elif label == "3": value = self.display.GetValue value = value + '3' self.display.SetValue(value) elif label == "4": value = self.display.GetValue value = value + '4' self.display.SetValue(value)

elif label == "5": value = self.display.GetValue value = value + '5' self.display.SetValue(value)

elif label == "6": value = self.display.GetValue value = value + '6' self.display.SetValue(value)

elif label == "7": value = self.display.GetValue value = value + '7' self.display.SetValue(value) elif label == "8": value = self.display.GetValue value = value + '8' self.display.SetValue(value)

elif label == "9": value = self.display.GetValue value = value + '9' self.display.SetValue(value)

elif label == "0": value = self.display.GetValue value = value + '0' self.display.SetValue(value)

elif label == ".": value = self.display.GetValue if value == True: value = value + '.' self.display.SetValue(str(value))

elif label == "*": self.operator = '*' value = self.display.GetValue self.temp = value value = '' self.display.SetValue(str(value)) elif label == "/": self.operator = '/' value = self.display.GetValue self.temp = value value = '' self.display.SetValue(str(value)) elif label == "+": self.operator = '+' value1 = self.display.GetValue self.temp = value1 value1 = '' self.display.SetValue(str(value1)) print "before",self.temp, "value1",value1 elif label == "-": self.operator = '-' value = self.display.GetValue self.temp = value value = '' self.display.SetValue(str(value)) elif label == "=": value = self.display.GetValue if self.operator == '*': answer = int(self.temp) * int(value) elif self.operator == '/': if (value == 0): self.display.StaticText("sdf") else: answer = int(self.temp) / int(value) elif self.operator == '+': answer = int(self.temp) + int(value) elif self.operator == '-': answer = int(self.temp) - int(value) self.absoluteValue = answer self.display.SetValue(str(answer))

#database connection # con = pgdb.connect( user='jdg', host='localhost', database='jdg', password = 'jdg' ) # cur = con.cursor # cur.execute( "INSERT INTO calculator (answers) VALUES (%d)" % (int(value))) #con.commit #con.close

print "First value", value print "Temp ", self.temp print "Answer", float(answer) elif label == "Absolute": self.absoluteValue = self.absoluteValue * -1 value = self.absoluteValue self.display.SetValue(str(value))

app = wx.App Calculator(None, -1, 'Calculator (Pre-Prefinal)') app.MainLoop

Speedy deletion nomination of C morse


A tag has been placed on C morse requesting that it be speedily deleted from Wikipedia. This has been done under section A3 of the criteria for speedy deletion, because it is an article with no content whatsoever, or whose contents consist only of external links, a "See also" section, book references, category tags, template tags, interwiki links, a rephrasing of the title, or an attempt to contact the subject of the article. Please see Wikipedia:Stub for our minimum information standards for short articles. Also please note that articles must be on notable subjects and should provide references to reliable sources that verify their content.

If you think that this notice was placed here in error, contest the deletion by clicking on the button labelled "Click here to contest this speedy deletion". Doing so will take you to the talk page where you will find a pre-formatted place for you to explain why you believe the page should not be deleted. You can also visit the page's talk page directly to give your reasons, but be aware that once tagged for speedy deletion, if the page meets the criterion, it may be deleted without delay. Please do not remove the speedy deletion tag yourself, but don't hesitate to add information to the page that would render it more in conformance with Wikipedia's policies and guidelines. If the page is deleted, you can contact one of these administrators to request that the administrator userfy the page or email a copy to you. → Σ  τ  c. 08:34, 30 November 2011 (UTC)