擅长:python、mysql、java
<p>让我们看看有问题的那条线,找出其中的一些问题。
下面是一行:</p>
<pre><code>mlabel2 = Label(root, text='რეგულარი >> '+2.23+ 'GEL').pack()
</code></pre>
<p>您正在连接一个字符串、一个浮点和另一个字符串。解决这个问题最简单的方法是使用一些字符串格式表达式,比如</p>
^{pr2}$
<p>对于Python3代码来说,这是一个很好的解决方案。。。请注意,<code>{num}</code>是一个格式化命令,它将被您的float替换。还有其他方法可以处理这个问题,但是由于您使用的是python3,所以我将使用这个方法。另外,因为这个数字在不同的标签上都有变化,所以我把它分开,这样就很容易处理了。在</p>
<p>另外,请记住,由于返回<em>None</em>的<code>.pack()</code>命令,您的<strong>mlabel2</strong>在代码中将是<em>None</em>。如果你想保存mlabel2</strong>,你必须把语句分成两部分。。。在</p>
<pre><code>mlabel2 = Label(root, .... GEL')
mlabel2.pack()
</code></pre>
<p>这对于大多数小部件都是一样的,包括标签、条目和按钮。您的<code>def gamotvla():</code>中的<code>if</code>语句也会给您带来问题,但让我们从这些开始。在</p>