0

I am making a library in Python, and I have a function that is supposed to create a new line of text in a GUI every time you use it. This is using Tkinter as the graphical library it's built on top of.

I first tried

def newtext(n,t):
    str(n) = Label(text=t)

with

from aiui import *
newtext("test","test")

In the other file, This didn't work, which was expected because you can't put a variable in a string for it to work, but I wanted to try anyway. Then I tried just putting it as n without the str modifier, but obviously that didn't work. Now I'm stuck and don't know what to try. Is there a function or way you can even do this?

Chickenman
  • 13
  • 2
  • 4
    This almost certainly isn't the right solution to whatever problem you're trying to solve. Dynamically creating variables based on a passed-in name is generally considered a bad practice. Why do you think you need to do that? – Bryan Oakley Jan 10 '23 at 04:14

0 Answers0