草庐IT

got_frame

全部标签

python - 如何在 Tkinter 中更改 Frame 的背景?

我一直在使用Python3.3中的Tkinter创建一个Email程序。在各种网站上,我看到Frame小部件可以使用Frame.config(background="color")获得不同的背景。但是,当我在我的框架中使用它时,会出现以下错误:_tkinter.TclError:unknownoption"-Background"执行以下操作时不起作用:frame=Frame(root,background="white")或者:frame=Frame(root)frame.config(bg="white")我想不通。我会发布我的整个源代码,但我不希望它暴露在互联网上,但是框架创建是

python - Jupyter笔记本: TypeError: __init__() got an unexpected keyword argument 'io_loop'

我最近在我的macbookpro上安装了jupyternotebooks。当我创建一个新笔记本时,我在启动笔记本的终端上看到以下异常。Monideeps-MacBook-Pro:PythonNotebooksmonideepde$jupyter-notebook[I12:18:43.675NotebookApp]Servingnotebooksfromlocaldirectory:/Users/monideepde/Documents/PythonNotebooks[I12:18:43.675NotebookApp]0activekernels[I12:18:43.676Noteboo

python - IntelliJ Python 3 检查 "Expected a dictionary, got a dict"是否是带有 **kwargs 的 super 的误报?

我使用Python3并想用一个自定义类来包装argparse.ArgumentParserformatter_class=argparse.RawDescriptionHelpFormatter默认。我可以成功地做到这一点,但是带有Python插件(PyCharm)的IntelliJIDEA2017.1会针对以下代码发出警告:classCustomParser(argparse.ArgumentParser):def__init__(self,formatter_class=argparse.RawDescriptionHelpFormatter,**kwargs):#noinspec

python - 在 Tkinter 应用程序中是否从 Frame 继承

我见过两种设置tkinter程序的基本方法。有什么理由比另一个更喜欢一个吗?fromTkinterimport*classApplication():def__init__(self,root,title):self.root=rootself.root.title(title)self.label=Label(self.root,text='Hello')self.label.grid(row=0,column=0)root=Tk()app=Application(root,'SampleApp')root.mainloop()和fromTkinterimport*classAppl

python - OpenCV/Python : read specific frame using VideoCapture

有没有办法使用VideoCapture()方法获取特定帧?我当前的代码是:importnumpyasnpimportcv2cap=cv2.VideoCapture('video.avi')This是我的引用教程。 最佳答案 感谢GPPK。视频参数应以整数形式给出。每个标志都有自己的值。见here代码。正确的解决方法是:importnumpyasnpimportcv2#Getvideonamefromuser#Ginenvideonamemustbeinquotes,e.g."pirkagia.avi"or"plaque.avi"vi

python - 如何阻止 Tkinter Frame 缩小以适应其内容?

这是给我带来麻烦的代码。f=Frame(root,width=1000,bg="blue")f.pack(fill=X,expand=True)l=Label(f,text="hi",width=10,bg="red",fg="white")l.pack()如果我用Label注释掉行,Frame会以正确的宽度显示。但是,添加标签似乎会将框架缩小到标签的大小。有没有办法防止这种情况发生? 最佳答案 默认情况下,pack和grid都会缩小或放大小部件以适应其内容,这在99.9%的情况下都是您想要的。描述此功能的术语是几何传播。使用pac

python - Python 脚本 "Expected 2D array, got 1D array instead:"中的错误?

我正在关注thistutorial进行这个ML预测:importnumpyasnpimportmatplotlib.pyplotaspltfrommatplotlibimportstylestyle.use("ggplot")fromsklearnimportsvmx=[1,5,1.5,8,1,9]y=[2,8,1.8,8,0.6,11]plt.scatter(x,y)plt.show()X=np.array([[1,2],[5,8],[1.5,1.8],[8,8],[1,0.6],[9,11]])y=[0,1,0,1,0,1]X.reshape(1,-1)clf=svm.SVC(ke

python - Django 错误 : render_to_response() got an unexpected keyword argument 'context_instance'

升级到Django1.10后,我收到错误render_to_response()gotanunexpectedkeywordargument'context_instance'。我的看法如下:fromdjango.shortcutsimportrender_to_responsefromdjango.templateimportRequestContextdefmy_view(request):context={'foo':'bar'}returnrender_to_response('my_template.html',context,context_instance=Request

python - pip 抛出 TypeError : parse() got an unexpected keyword argument 'transport_encoding' when trying to install new packages

我正在使用最新版本的Anaconda3。我刚刚安装了它,我正在尝试下载一些软件包。我正在使用Anaconda提示。在尝试使用pip做任何事情(包括升级现有软件包)时,我得到以下回溯。Exception:Traceback(mostrecentcalllast):File"C:\Users\csprock\Anaconda3\lib\site-packages\pip\basecommand.py",line215,inmainstatus=self.run(options,args)File"C:\Users\csprock\Anaconda3\lib\site-packages\pi

java - 这是向 Java Frame 教授有关 Windows 的 Aero Snap 功能的唯一方法吗?

如果我通过单击WindowsWindowDecoration的最小化按钮来最小化被Aero捕捉到屏幕左侧的JFrame并通过Alt-Tabbing或在Windows中单击它来取消最小化任务栏,框架被正确地恢复到左侧。好!但是如果我将框架最小化setExtendedState(getExtendedState()|Frame.ICONIFIED);并通过将鼠标悬停在Windows任务栏上来查看预览,它显示框架的位置错误。通过Alt-Tabbing取消最小化它或在Windows任务栏中单击它后,框架将恢复到错误的位置和大小。框架边界是“未对齐”值,如果您将框架拖离ScreenBorder,