Está en la página 1de 3

import clr

import sys
import System
clr.AddReference('System.Windows.Forms')
clr.AddReference('System.Drawing')
from System.Windows.Forms import*
from System.Drawing import*
class myform(Form):
def __init__(self):
Form.__init__(self)
self.Text = "My Trial"
self.Size = Size(400, 400)
self.CenterToScreen()
self.Show()
self.tb1 = TextBox()
self.tb1.Location = Point(20, 20)
self.tb1.Parent = self
self.tb2 = TextBox()
self.tb2.Location = Point(20, 60)
self.tb2.Parent = self
self.tb3 = TextBox()
self.tb3.Location = Point(20, 100)
self.tb3.Parent = self
self.btn = Button()
self.btn.Text = "Click"
self.btn.Location = Point(20, 140)
self.btn.Parent = self
self.btn.Click += self.dothis
self.tb4 = TextBox()
self.tb4.Location = Point(200, 20)
self.tb4.Parent = self
self.tb5 = TextBox()
self.tb5.Location = Point(200, 60)
self.tb5.Parent = self
self.tb6 = TextBox()
self.tb6.Location = Point(200, 100)
self.tb6.Parent = self
def dothis(self, sender, event):
L1 = float(self.tb1.Text)
L2 = float(self.tb2.Text)
if self.tb3.Text == "c":
ch = 3
if L1>L2:
cll = 10
L = L2/L1
csl = cll*L

elif L2>L1:
csl = 10
L = L1/L2
cll = csl*L
elif L1 == L2:
cll, csl = 10, 10
#-----------------------------------------#
if self.tb3.Text == "m":
ch = 4
if L1>L2:
cll = 20
L = L2/L1
csl = cll*L
elif L2>L1:
csl = 20
L = L1/L2
cll = csl*L
elif L1 == L2:
cll, csl = 20, 20
#-----------------------------------------#
if self.tb3.Text == "f":
ch = 5
if L1>L2:
cll = 40
L = L2/L1
csl = cll*L
elif L2>L1:
csl = 40
L = L1/L2
cll = csl*L
elif L1 == L2:
cll, csl = 40, 40
#-----------------------------------------#
if csl<3:
csl = 3
elif cll<3:
cll = 3
#-----------------------------------------#
if csl>40:
csl = 40
elif cll>40:
cll = 40
#-----------------------------------------#
clli = int(cll)
csli = int(csl)
chi = int(ch)
self.tb4.Text = str(clli)
self.tb5.Text = str(csli)
self.tb6.Text = str(chi)
Application.EnableVisualStyles()
form = myform()

Application.Run(form)

También podría gustarte