Hey there,
i would like to do a rank of the averages, but when i click in the button ranking, it says that global name 'media1' is not defined.
can someone help me please? thanks in
# -*- coding: cp1252 -*-
import wx
class duff(wx.Frame):
def __init__(self,parent,id):
wx.Frame.__init__(self,parent,wx.ID_ANY,'Duffan Formula', size=(400,370)) #wx.ID_ANY
self.panel = wx.Panel(self) #self.panel
#self.panel on all
g=wx.StaticText(self.panel,-1,"________________________________________________________",pos=(10,65))
z=wx.StaticText(self.panel,-1,"Welcome to Duffan Formula!!",pos=(10,10))
r=wx.StaticText(self.panel,-1,"Here you can discover the score of any girl you are looking for.",pos=(10,30))
q=wx.StaticText(self.panel,-1,"Use it, with Knowledge!",pos=(10,50))
a=wx.StaticText(self.panel,-1,"What`s her name?",pos=(10,110))
b=wx.StaticText(self.panel,-1,"What`s her beauty score?",pos=(10,150))
c=wx.StaticText(self.panel,-1,"What`s her body score?",pos=(10,190))
average=wx.StaticText(self.panel,-1,"Average 1: ", pos=(15,250)).SetForegroundColour('blue')
averagetwo=wx.StaticText(self.panel,-1,"Average 2: ", pos=(15,270)).SetForegroundColour('blue')
averagethree=wx.StaticText(self.panel,-1,"Average 3: ", pos=(15,290)).SetForegroundColour('blue')
self.one=wx.TextCtrl(self.panel,-1,'Enter name',pos=(110,108),size=(80,20))
self.two=wx.SpinCtrl(self.panel,-1,'1',pos=(150,148),size=(60,20),min=0,max=100)
self.three=wx.SpinCtrl(self.panel,-1,'1',pos=(130,188),size=(60,20),min=0,max=100)
wx.StaticBox(self.panel,-1,'Personal Info', (5,90),size=(250,230))
girlone=wx.Button(self.panel,label="Girl 1",pos=(10,220),size=(60,20))
girlone.Bind(wx.EVT_BUTTON,self.clickbutton1)
girltwo=wx.Button(self.panel,label="Girl 2",pos=(80,220),size=(60,20))
girltwo.Bind(wx.EVT_BUTTON,self.clickbutton2)
girlthree=wx.Button(self.panel,label="Girl 3",pos=(150,220),size=(60,20))
girlthree.Bind(wx.EVT_BUTTON,self.clickbutton3)
rank = wx.Button(self.panel, label="Ranking:", pos=(280, 80),size=(60,30))
rank.Bind(wx.EVT_BUTTON, self.clickrank)
self.Centre()
self.Show(True)
def clickbutton1(self,event):
name1=self.one.GetValue()
r1=self.two.GetValue()
c1=self.three.GetValue()
media1 = (r1*3 +c1*2)/5
wx.StaticText(self.panel,-1, str(media1) ,pos=(80,250)).SetForegroundColour('blue') #str(media)
def clickbutton2(self,event):
name2=self.one.GetValue()
r2=self.two.GetValue()
c2=self.three.GetValue()
media2 = (r2*3 +c2*2)/5
wx.StaticText(self.panel,-1, str(media2) ,pos=(80,270)).SetForegroundColour('blue') #str(media)
def clickbutton3(self,event):
name3=self.one.GetValue()
r3=self.two.GetValue()
c3=self.three.GetValue()
media3 = (r3*3 +c3*2)/5
wx.StaticText(self.panel,-1, str(media3) ,pos=(80,290)).SetForegroundColour('blue') #str(media)
def clickrank(self,event):
wx.StaticText(self.panel,-1, "1º:" ,pos=(260,120)).SetForegroundColour('blue') #str(media)
wx.StaticText(self.panel,-1, "2º:" ,pos=(260,140)).SetForegroundColour('blue') #str(media)
wx.StaticText(self.panel,-1, "3º:" ,pos=(260,160)).SetForegroundColour('blue') #str(media)
if media1>media2>media3:
wx.StaticText(self.panel,-1, "guy" ,pos=(260,160)).SetForegroundColour('blue') #str(media)
wx.StaticText(self.panel,-1, "hyi" ,pos=(260,160)).SetForegroundColour('blue') #str(media)
wx.StaticText(self.panel,-1, "ytg" ,pos=(260,160)).SetForegroundColour('blue') #str(media)
if __name__=='__main__':
app=wx.PySimpleApp()
frame=duff(parent=None,id=-1)
frame.Show()
app.MainLoop()