Generation

generate functionThu, 13 Apr 2023

Haz un diseño minimalista de los botones y la pantalla de una calculadora

from tkinter import * root = Tk() root.title("Calculator") bttn_list = [ "7", "8", "9", "+", "*", "4", "5", "6", "-", "/", "1", "2", "3", "=", "x²", "0", ".", "C", "±", "√" ] r = 1 c = 0 for i in bttn_list: rel = "" cmd=lambda x=i: calc(x) ttk.Button(root, text=i, command = cmd, width = 10).grid(row=r, column = c) c += 1 if c > 4: c = 0 r += 1 def calc(key): global memory if key == "=": str1 = "-+0123456789.*/)(" if calc_entry.get()[0] not in str1: calc_entry.

Want to kickstart your project?Use the new AI Studio to create your code