【问题标题】:With Tkinter in Python. How do I call a list variable into a canvas one at a time在 Python 中使用 Tkinter。如何一次将列表变量调用到画布中
【发布时间】:2016-11-21 14:35:42
【问题描述】:

在 Python 中使用 Tkinter。如何在按下按钮时一次将列表变量调用到画布中(在这种情况下。next)。这是我尝试过的。我是编程新手。

def _next_(self):
    def y(self):
        a='hey'
        b='you'
        e=[a,b]
        for i in (e):
            while True:
                 print i
                 break
    x=y
    self.ques = self.canvas1.create_text(380,40, text= self.x())

【问题讨论】:

  • 请格式化您的代码

标签: python canvas tkinter


【解决方案1】:

这是你要找的东西吗:

from tkinter import *
root = Tk()

textList = ["Hey", "you", "whatsup"]

mycanvas = Canvas(root)
mycanvas.pack()

textobj = mycanvas.create_text(100, 50)

def f():
    mycanvas.itemconfig(textobj, text=textList)

mybutton = Button(root, text="Click", command=f)
mybutton.pack()

?

【讨论】:

    猜你喜欢
    • 2019-05-01
    • 1970-01-01
    • 2021-03-30
    • 1970-01-01
    • 2017-10-11
    • 1970-01-01
    • 2015-08-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多