以下代码给出了此错误"令牌错误:多行语句中的EOF".这个错误是什么?我该如何解决?
import easygui
import time
namegui = easygui.enterbox(msg='Enter your name:', title='Name query', default='Gian')
situationgui = easygui.enterbox(msg='Please enter your situation:', title='Thought Log(Situation)')
thoughtsgui = easygui.enterbox(msg='Please enter your thoughts:', title='Thought Log(Thoughts')
emotionsgui = easygui.enterbox(msg='Please enter your emotions: \n Sad, Mad, Hurt, Depressed, Anxious, Tense, etc.', title='Thought Log(Emotions')
behaviorgui = easygui.enterbox(msg='Please enter your behavior:', title='Thought Log(Behavior')
thinking_trapsgui = easygui.enterbox(msg='Please identify your thinking traps: \n \n'
'FORTUNE-TELLING: This occurs when we predict that things will turn out badly. However, we cannot predict the future …Run Code Online (Sandbox Code Playgroud) 我使用的是 Python 2.7.9、easygui 0.97.4Windows 7。
我正在尝试使用以下内容弹出一个对话框:
import easygui
easygui.msgbox()
Run Code Online (Sandbox Code Playgroud)
我希望弹出一个对话框并进入前台,集中注意力。有时,会发生这种情况。其他时候,对话框不会出现在前面,而是出现在所有其他窗口的后面。
对话框是出现在前面,还是隐藏在其他窗口后面,似乎取决于一些不可预测的事情。给出不同的论点easygui.msgbox()似乎没有帮助。重新启动 Python 解释器有时会使其工作,有时则不会。
这个问题对于简单的对话框来说还不错,至少在任务栏中有一个闪烁的按钮来引起你的注意。

更糟糕的是diropenbox(),它不会在任务栏中产生闪烁的按钮。对话框在一个窗口后面生成并且没有证据表明它在那里,直到您最小化所有其他窗口。


如何强制easygui对话框始终出现在前面并始终聚焦,而不是隐藏在其他窗口后面?
我仔细阅读了Github robertlugg/easygui问题跟踪器,似乎没有关于此问题的任何未解决的错误报告。
编辑:我打开了一个错误报告 - https://github.com/robertlugg/easygui/issues/76。
如何更改 EasyGUI 中输入框和消息文本的字体设置?我知道您必须在某个地方编辑文件,但仅此而已。确切地如何做到这一点以及编辑什么内容将不胜感激。
提前致谢。
我一直在使用 easygui 在我的项目中打开文件和其他任务,通常它工作得很好。但是,当使用 fileopenbox 时,我无法让它仅显示某种类型的文件。
在下面的代码片段中,我期望获得仅 *.csv 文件的列表,但它为我提供了目录中的所有内容。我担心这对用户来说有点不方便,并且希望能够对其进行过滤以方便使用。
import easygui as eg
infile = eg.fileopenbox(msg='Please locate the csv file',
title='Specify File', default='c:\data\det\*.csv')
refdata = pd.read_csv(infile)
Run Code Online (Sandbox Code Playgroud)
现在,我得到的已经很接近了。在文件打开对话框的底部,您可以选择文件类型,它只预加载了两个选择:所有文件(.)和csv文件(*.csv),所以我对默认参数的设置似乎正在做一些事情,它只是比我想要它做的事情(即过滤列表以使用户更容易)稍稍停止了一点。
感谢有关如何执行此操作的任何提示。如果有一种不涉及 easygui 的方法可以做到这一点,那么就我而言,这也是一个很好的解决方案。
有没有办法通过 C++ 使用 tkinter 编写 GUI 程序?我问这个问题是因为我知道如何在 Python 中使用 tkinter 进行编程,但对于我的应用程序,我无法使用 Python。
如果没有,我想用 C++ 开发一个 GUI 应用程序,它可以使用 MySQL 来显示和存储信息,我想制作一些可以像 tkinter 一样缩放的绘图(画布),并且还可以与某些硬件交互。我想在 Raspberry 或 Parallella 板上使用它。我知道有 wxWidgets 和 GTK+,其中哪一个更适合我的应用程序?哪个最容易使用?还有其他更简单的解决方案吗?
我创建了一个非常简单的应用程序,它提供了一个easygui entrybox()并在接收用户输入时继续无限循环.
我可以使用"取消"按钮退出程序,因为这会返回"无",但我还希望能够使用标准的"关闭"按钮退出程序.(即Windows窗口的右上角,Mac窗口的左上角)此按钮当前不执行任何操作.
看一下easygui模块,我找到了这一行:
root.protocol('WM_DELETE_WINDOW', denyWindowManagerClose )
Run Code Online (Sandbox Code Playgroud)
这似乎是罪魁祸首.我不是TKinter专家,但我可能会想出如何改变这个处理程序以我想要的方式行事.
但是,因为我不想搞乱easygui模块,有没有办法从我的主脚本覆盖这个行为,并且关闭按钮要么直接关闭程序还是返回None?
我正在使用 fileopenbox() 并且我想在 Windows 框打开时选择我拥有的所有文本文件。我试过按 shift 或 ctrl + A,但没有用。
openfile = fileopenbox("Welcome", "COPR", filetypes= "*.txt")
Run Code Online (Sandbox Code Playgroud) 预先警告,我刚开始学习Python,这是我第一次在这个网站上学习.如果我的行为像n00b,请不要讨厌.
所以我创建了一个程序,它应该告诉你以光速和光速的因素来到达星(指定距离)需要多长时间.它从一个名为easygui的库开始,它创建了一个很好的窗口,用户可以选择一个因子.他们选择的因素成为变量"选择".这部分代码工作正常.理想情况下,该值将被输入到一个函数中,该函数将进行分解,并返回行程天数的值.这是不成功的.最有可能的是,我只是设置错了,所以如果有人知道使用函数的正确方法,我真的很感谢你的帮助!哦,我试着疯狂地评论,所以希望一切都有意义!
import easygui as eg #the gui creation library I am using
dist = 41000000000000 #distance to the star
light = 300000 #speed of light
def Convert (factor): #takes in factor chosen by user
speed = light*factor #the speed is the factor multiplied by the speed of light
time = (dist/speed)/3600 # the time is the distance/divided by the speed, since thats a huge value in seconds, the /3600 should reduce it to days
return time #"should" return the …Run Code Online (Sandbox Code Playgroud) 当我运行下面的代码时,会弹出以下消息框.为什么要打印那些我不想要它们的烦人牙箍呢?我使用的是Python 2.7和EasyGui.

from __future__ import division
from easygui import *
import ystockquote
def main():
PRHSX_message()
def PRHSX_message():
prhsx_share_price = float(ystockquote.get_last_trade_price('PRHSX'))
prhsx_daily_change = ystockquote.get_change('PRHSX')
prhsx_total_shares = 47.527
prhsx_starting_value = 2500
prhsx_percent_change = (((prhsx_share_price * prhsx_total_shares) / prhsx_starting_value) - 1) * 100
prhsx_percent_change = str("%.2f" % prhsx_percent_change) + "%"
prhsx_current_value = prhsx_share_price * prhsx_total_shares
prhsx_profit = prhsx_current_value - prhsx_starting_value
prhsx_current_value = "$" + str("%.2f" % prhsx_current_value)
prhsx_profit = "$" + str("%.2f" % prhsx_profit)
prhsx_string = "T. Rowe Price Roth IRA Account\n____________________________\n \ …Run Code Online (Sandbox Code Playgroud) 这是我关于Stack Oveflow的第一个问题,如果我做错了,请原谅我.我已经使用Python几个月了.我正在尝试制作一个简单的GUI.我遇到了EasyGUI.
当我尝试导入模块时,我收到一个错误:
Traceback (most recent call last):
File "C:/Users/matthewr/PycharmProjects/testing start/Tsting.py", line 1, in <module>
import easygui
File "C:\Users\matthewr\AppData\Local\Programs\Python\Python35-32\lib\site-packages\easygui\__init__.py", line 50, in <module>
from .boxes.choice_box import choicebox
File "C:\Users\matthewr\AppData\Local\Programs\Python\Python35-32\lib\site-packages\easygui\boxes\choice_box.py", line 76
except Exception, e:
^
SyntaxError: invalid syntax
Run Code Online (Sandbox Code Playgroud)
我删除了代码中的所有内容,import easygui但错误仍然出现.
我使用pip卸载并重新安装,但没有运气.
任何帮助,将不胜感激.
easygui ×10
python ×8
tkinter ×3
c++ ×1
canvas ×1
eof ×1
formatting ×1
function ×1
import ×1
importerror ×1
mysql ×1
python-3.x ×1
string ×1