Saturday, 15 June 2013

tkinter - How to use .get() within a function. Python -


itemprop = "text"> Tkinter import * Import random Factorer def (a, b, c) to
 :   after 

random_a1 = Random. Randint (-10,10) random_a2 = random.randint (-10,10) random_c1 = random.randint (-10,10) random_c2 = random.randint (-10,10) if random_a1 == 0 or random_a2 == 0 Or random_c1 == 0 or random_c2 == 0: elif (random_a1 * random_c2) + (random_a2 * random_c1) == b and random_a1 / random_c1 = random_a2 / random_c2 and random_a1 * random_a2 == another random_c1 * random_c2 == C: Brake print "y = (% dx + (% d)) (% dx + (% d))"% (random_a1, random_c1, random_a2, random_c2) root = Tk () ButtonSim 1 = Button (root, text = "convert "Command = lambda: Factorer (enterA.get (), enterB.get (), enterC.get ())) buttonSim1.grid (line = 2, column = 3) enterA = entry (root) enterA.grid (line = 1, column = 1) enterB = entry (route) enterB.grid (line = 1, column = 2) enterC = Entry (route) enterC.grid (line = 1, column = 3) root.mainloop ()

I can get this code to run here, every The times when I click on the button, it just crashes, it works, but if I delete .get () and include the numbers. Thank you in advance

You are comparing the string in ints, inserting a, b and c to int:

  Tkinter.Button (root, text = "convert", command = lambda: Factorer (integer .get ()), int (enterB.get ()), int (enterC.get ()))  

No comments:

Post a Comment