'How to continuously print a while loop output on to TKINTER Lable
from cgitb import text
from decimal import Decimal
from turtle import bgcolor, width
from web3 import Web3
import time
from tkinter import *
root=Tk()
root.title('Drip Bot')
root.geometry('1600x800')
frameMain=LabelFrame(root,text="main frame")
frameContent=LabelFrame(frameMain, text="frame content")
frameCtrl=LabelFrame(frameMain,text="Control", borderwidth=2)
fromLabel=Label(frameCtrl,text="from")
fromEntry=Entry(frameCtrl,text="from")
toLabel=Label(frameCtrl,text="To")
toEntry=Entry(frameCtrl,text="from")
n=0
while True:
n += 1
print(n)
screenLabel=Label(frameContent,text=n ,width=170,height=42,borderwidth=4,relief='solid')
frameCtrl.grid(row=1, column=1)
frameContent.grid(row=1, column=2)
frameMain.pack()
fromLabel.pack()
fromEntry.pack()
toLabel.pack()
toEntry.pack()
screenLabel.pack()
root.mainloop()
I am using a while loop in my function to print out the value of n. The issue is that I want to print n on to the label. I am confused on how to go about it. I don't know if my question is clear enough. I have tried passing n in to the label text attributes but it doesn't show on the label. In fact, it shows that n is not defined. Please how do I achieve this? Or is it possible display my terminal or tkinter label.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
