gpt4 book ai didi

文本框中文本周围的 Python 2.7.10 Tkinter 大括号

转载 作者:太空宇宙 更新时间:2023-11-04 00:58:24 24 4
gpt4 key购买 nike

我已经制作了 GUI,一切运行正常,但是当文本出现时,它在大括号中

示例代码:

message = "You need to burn another", wfmlvl - fmlvl, "logs to level up"

我正在为 Runescape 制作一个生火计算器,现在我想知道如何去掉文本框中文本周围的大括号。 wfmlvlfmlvl 是在输入框中设置的变量。

我已经做到了,所以他们输入的内容设置为 fmlvl1wfmlvl1 例如

def reveal(self):

fmlvl1 = self.fmlvl.get()
wfmlvl = self.wfmlvl.get()

fmlvl = int(fmlvl1)
wfmlvl = inf(wfmlvl1)

当显示文本时,它看起来像这样:

{You need to burn another} 45 {logs to level up}

我怎样才能去掉大括号?

最佳答案

像这样创建您的消息:

message = "You need to burn another {} logs to level up".format(wfmlvl - fmlvl)

关于文本框中文本周围的 Python 2.7.10 Tkinter 大括号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33970120/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com