小编Jam*_*kin的帖子

我收到错误 _tkinter.TclError: bad window path name ".!button",我不知道为什么

我决定尝试使用类来重新创建游戏,这样我就不必使用全局变量,但是当我尝试运行游戏时,我遇到了错误。

Traceback (most recent call last):  File "D:\Users\James\Desktop\botmod OOP\index.py", line 203, in <module>    Game.New_Game(Root)  File "D:\Users\James\Desktop\botmod OOP\index.py", line 18, in New_Game    Play_Button = self.Start_Canvas.create_window(300, 325, window = Play_Button)  File "C:\Users\James\AppData\Local\Programs\Python\Python36\lib\tkinter\__init__.py">, line 2501, in create_window    return self._create('window', args, kw)  File "C:\Users\James\AppData\Local\Programs\Python\Python36\lib\tkinter\__init__.py">, line 2474, in _create    *(args + self._options(cnf, kw))))
_tkinter.TclError: bad window path name ".!button"
Run Code Online (Sandbox Code Playgroud)

我已经尽我最大的能力研究了这个问题,并且无法单独解决错误是什么。下面是我的代码,如果需要,我可以提供所有代码,只是评论。它应该创建一个 Tkinter 按钮,然后将其应用于画布,但它给了我上面的错误。

def New_Game(self, Root):        
    self.Start_Canvas = Canvas(Root, width = 600, height = 500, bd=0, highlightthickness=0, bg = '#ffffff')
    self.Start_Canvas.pack()

    Title = self.Start_Canvas.create_text(300, 163, text …
Run Code Online (Sandbox Code Playgroud)

python oop tkinter

6
推荐指数
1
解决办法
1万
查看次数

如何在discord.js中制作菜单?

我目前正在使用 discord.js 制作一个不和谐的机器人,我正在尝试制作一个菜单命令,所以当用户输入 [prefix]menu 时,它会发送一张菜单图片,我可以轻松地做到这一点,但我正在尝试将其设为多页,我知道我可以只做一个 menu1、menu2 和 menu3 命令,但我喜欢有一个命令说 nextpage 和 previouspage 这是我目前所拥有的但它不起作用并且没有错误

      if (command === "menu") {
          output()
            message.channel.send({file: './images/menu1.png'});
            curPage = 1;
        }

        if (command === "next page") {
          output()
                curPage++;
                if(curPage >= 3) {
                  output()
                    curPage = 3; message.channel.send("You're on the last page!");
                }
            } else if (command === "previous page") {
              output()
                curPage--;
                if(curPage <= 0) {
                  output()
                    curPage = 1; message.channel.send("You're on the first page!");
                }
                message.channel.send({file: `./images/menu${curPage}.png`});
            }
Run Code Online (Sandbox Code Playgroud)

javascript node.js discord.js

0
推荐指数
1
解决办法
1万
查看次数

标签 统计

discord.js ×1

javascript ×1

node.js ×1

oop ×1

python ×1

tkinter ×1