add 8 check boxes in tkinter named Pin 0 to Pin 7 in the following code : import time…
- User
add 8 check boxes in tkinter named Pin 0 to Pin 7 in the following code :
import time import threading import tkinter as tk
state = False
def AND_Gate(a,b): return a and b def OR_Gate(a,b): return a or b def NOT_Gate(a): return not a def NAND_Gate(a,b): return not(a and b) def NOR_Gate(a,b): return not(a or b) def XOR_Gate(a,b): return (a or b) and not(a and b) def XNOR_Gate(a,b): return not((a or b) and not(a and b))
def clock(update_clock,speed = 1): cycle = 0 global state while True: state = False time.sleep(1 / speed / 2) update_clock(f"State : False , Cycle {cycle}") state = True time.sleep(1 / speed / 2) update_clock(f"State : True , Cycle {cycle}") cycle += 1
window = tk.Tk() window.title("Intel 4004") window.geometry("400x300") clock_label = tk.Label(window, text="", font=("Arial", 14)) clock_label.pack() def update_clock(text): clock_label.config(text=text) clock_thread = threading.Thread(target=clock,args=(update_clock,),daemon=True) clock_thread.start() window.mainloop()
- Assistant
To add 8 checkboxes named "Pin 0" to "Pin 7" to your Tkinter application, you'll need to create widgets within your Tkinter window. Each can be associated with a to track its state. Here's how you can modify your code to include these checkboxes: