草庐IT

python - 在 ubuntu 14.04 上安装 tkinter

我想在Ubuntu14.04上运行python代码,但是当我执行它时,它给了我以下错误消息Traceback(mostrecentcalllast):File"main.py",line2,infromtkinterimport*ImportError:Nomodulenamedtkinter 最佳答案 尝试在终端中编写以下内容:sudoapt-getinstallpython-tk不要忘记在程序开始时实际导入Tkinter模块:importTkinter 关于python-在ubunt

python - 在 ubuntu 14.04 上安装 tkinter

我想在Ubuntu14.04上运行python代码,但是当我执行它时,它给了我以下错误消息Traceback(mostrecentcalllast):File"main.py",line2,infromtkinterimport*ImportError:Nomodulenamedtkinter 最佳答案 尝试在终端中编写以下内容:sudoapt-getinstallpython-tk不要忘记在程序开始时实际导入Tkinter模块:importTkinter 关于python-在ubunt

python - Tkinter:AttributeError:NoneType 对象没有属性<属性名称>

我创建了这个简单的GUI:fromtkinterimport*root=Tk()defgrabText(event):print(entryBox.get())entryBox=Entry(root,width=60).grid(row=2,column=1,sticky=W)grabBtn=Button(root,text="Grab")grabBtn.grid(row=8,column=1)grabBtn.bind('',grabText)root.mainloop()我启动并运行了UI。当我单击Grab按钮时,控制台上出现以下错误:C:\Python>python.exemyFi

python - Tkinter:AttributeError:NoneType 对象没有属性<属性名称>

我创建了这个简单的GUI:fromtkinterimport*root=Tk()defgrabText(event):print(entryBox.get())entryBox=Entry(root,width=60).grid(row=2,column=1,sticky=W)grabBtn=Button(root,text="Grab")grabBtn.grid(row=8,column=1)grabBtn.bind('',grabText)root.mainloop()我启动并运行了UI。当我单击Grab按钮时,控制台上出现以下错误:C:\Python>python.exemyFi

python - 隐藏轴标签

我试图在211处隐藏第一个子图上的轴标签。我想标记这个数字,而不仅仅是一个子图(引用:“Isub事件特征”)。如何控制字体属性,如大小、字体、颜色?f=Figure()vdsvgsPlot=f.add_subplot(211)vdsvgsPlot.plot(theLister()[3],theLister()[0])vdsvgsPlot.plot(theLister()[3],theLister()[1])isubPlot=f.add_subplot(212)isubPlot.plot(theLister()[3],theLister()[2])plotCanvas=FigureCan

python - 隐藏轴标签

我试图在211处隐藏第一个子图上的轴标签。我想标记这个数字,而不仅仅是一个子图(引用:“Isub事件特征”)。如何控制字体属性,如大小、字体、颜色?f=Figure()vdsvgsPlot=f.add_subplot(211)vdsvgsPlot.plot(theLister()[3],theLister()[0])vdsvgsPlot.plot(theLister()[3],theLister()[1])isubPlot=f.add_subplot(212)isubPlot.plot(theLister()[3],theLister()[2])plotCanvas=FigureCan

python - Tkinter:如何使用线程来防止主事件循环 "freezing"

我有一个带有“开始”按钮和进度条的小型GUI测试。期望的行为是:点击开始进度条振荡5秒进度条停止观察到的行为是“开始”按钮卡住5秒,然后显示进度条(无振荡)。到目前为止,这是我的代码:classGUI:def__init__(self,master):self.master=masterself.test_button=Button(self.master,command=self.tb_click)self.test_button.configure(text="Start",background="Grey",padx=50)self.test_button.pack(side=T

python - Tkinter:如何使用线程来防止主事件循环 "freezing"

我有一个带有“开始”按钮和进度条的小型GUI测试。期望的行为是:点击开始进度条振荡5秒进度条停止观察到的行为是“开始”按钮卡住5秒,然后显示进度条(无振荡)。到目前为止,这是我的代码:classGUI:def__init__(self,master):self.master=masterself.test_button=Button(self.master,command=self.tb_click)self.test_button.configure(text="Start",background="Grey",padx=50)self.test_button.pack(side=T

python - Python中Tk的背景颜色

我正在用Tkinter编写一个幻灯片程序,但我不知道如何将背景颜色更改为黑色而不是标准的浅灰色。如何做到这一点?importos,sysimportTkinterimportImage,ImageTkimporttimeroot=Tkinter.Tk()w,h=root.winfo_screenwidth(),root.winfo_screenheight()root.overrideredirect(1)root.geometry("%dx%d+0+0"%(w,h))root.focus_set()root.bind("",lambdae:e.widget.quit())image=

python - Python中Tk的背景颜色

我正在用Tkinter编写一个幻灯片程序,但我不知道如何将背景颜色更改为黑色而不是标准的浅灰色。如何做到这一点?importos,sysimportTkinterimportImage,ImageTkimporttimeroot=Tkinter.Tk()w,h=root.winfo_screenwidth(),root.winfo_screenheight()root.overrideredirect(1)root.geometry("%dx%d+0+0"%(w,h))root.focus_set()root.bind("",lambdae:e.widget.quit())image=