導航:首頁 > 編程語言 > pythonshowerror

pythonshowerror

發布時間:2022-04-29 05:31:24

1. python 3.4 中原來的tkMessageBox變成啥了

1、在python3.4中,原來的tkMessageBox變成tkinter.messagebox,效果如下圖。



(1)pythonshowerror擴展閱讀

python的應用

1、系統編程:提供API(Application Programming Interface應用程序編程介面),是很多系統管理員理想的編程工具。

2、圖形處理:有PIL、Tkinter等圖形庫支持,能方便進行圖形處理。

3、數學處理:NumPy擴展提供大量與許多標准數學庫的介面。

4、文本處理:python提供的re模塊能支持正則表達式,還提供SGML,XML分析模塊,許多程序員利用python進行XML程序的開發。

5、資料庫編程:程序員可通過遵循Python DB-API(資料庫應用程序編程介面)規范的模塊與Microsoft SQL Server,Oracle,Sybase,DB2,MySQL、SQLite等資料庫通信。

6、python自帶有一個Gadfly模塊,提供了一個完整的SQL環境。

7、網路編程:提供豐富的模塊支持sockets編程,能方便快速地開發分布式應用程序。

8、Web編程:應用的開發語言,支持最新的XML技術。

9、多媒體應用:Python的PyOpenGL模塊封裝了「OpenGL應用程序編程介面」,能進行二維和三維圖像處理。

10、pymo引擎:PYMO全稱為python memories off,是一款運行於Symbian S60V3,Symbian3,S60V5, Symbian3, Android系統上的AVG游戲。

2. python pil show()函數無法顯示圖片

調用Python的標准圖像庫里show()函數,有可能無法顯示圖片。因為他調用了xv,但xv在後面的ubuntu版本中xv都不裝了。
解決辦法:先裝一個ImageMagic,就相當於把xv的入口換成了ImageMagic的display。
sudo apt-get install imagemagick

安裝完成後記得重新啟動控制台。

3. python 自定義函數,無法理解其行為

i 未被定義

4. python CGI的form_data格式問題

if form.has_key('upfile'):
upfile = form["upfile"]
self.fn = upfile.filename or ''
if upfile.file:
self.fp = upfile.file
else:
self.fp = StringIO('(no data)')
else:
self.fp = StringIO('(no file)')
self.fn = ''

if not self.error:
self.doResults()
else:
self.showError()

if __name__ == '__main__':
page = AdvCGI()
page.go()

5. 求一份Python的實驗報告+源代碼,項目內容不限

#!/usr/bin/env python
# Filename: appui.py
"""

.. moleauthor:: ....
.. test mole of Tkinter
"""
from Tkinter import *
import tkMessageBox

root = Tk()
root.geometry('850x40+80+80') #設置窗體高寬與窗體相對屏幕左上角位置

class Appui(Frame):
"""
docsting for Appui
"""

def __init__(self, parent=None):
"""
Initialize the Appui Class
"""
Frame.__init__(self, width=850, height=60, bg='gray40')
self.propagate(False)
self.pack()
self.input = StringVar()
self.master.title('Test Widgets')
self.master.iconname('Tk-42')
self.buildFrame() # Build the widgets

def buildFrame(self):
"""
make the frame and add widgets into the frame
"""
self.LabelF=Frame(self,width=850, height=60, bg='gray80')
self.LabelF.propagate(False)
self.LabelF.pack(side=TOP)
Label(self.LabelF, fg='steelblue1', bg='gray80', text= "Text field description: ").pack(side=LEFT)
#設置輸入的widgets
self.e0 = Entry(self.LabelF, width=80, textvariable=self.input)
self.e0.pack(side=LEFT)
Button(self.LabelF, text='Get', borderwidth=5, command=self.callback).pack(side=RIGHT,padx=10)

def callback(self):
"""
callback of get path Button
"""
try:
#self.e0.delete(0,END)
Value=self.input.get()
if Value is not None:
print "Get String from Entry" + Value
else:
self.e0.delete(0,END)
except (RuntimeError, TypeError, NameError, ValueError, IOError) as e:
tkMessageBox.showerror("Error function callback()", '%s' % e)

def exit(self):
"""
exit of process
"""
exit(0)

def main():
"""
Main function
"""
Appui().mainloop()

if __name__ == '__main__':
main()

6. 設計python程序使 輸入字母時輸出Error

importre
name=raw_input("inputsomewords! ")
ifre.search(r'[a-zA-Z]',name):
print"ERROR"

可以用一個簡單的正則判斷,如果輸入的字母中含有字母則輸出error

7. python為什麼會出現這個error

#列表不能直接乘以非整數
>>>a=[1.0,2.0,3.0]
>>>a*3.1
Traceback(mostrecentcalllast):
File"<stdin>",line1,in<mole>
TypeError:can'tmultiplysequencebynon-intoftype'float'
#一種正確的用法
>>>map(lambdax:3*x,a)
[3.0,6.0,9.0]

8. 如何用python編寫彈出對話框,並選擇yes/no

如果使用 python 自帶的 tkinter 庫 是這樣實現的。

其他庫的話可以查看一下api。

fromTkinterimport*

fromtkMessageBoximport*


defanswer():

showerror("Answer","Sorry,noansweravailable")


defcallback():

ifaskyesno('Verify','Reallyquit?'):

showwarning('Yes','Notyetimplemented')

else:

showinfo('No','Quithasbeencancelled')


Button(text='Quit',command=callback).pack(fill=X)

Button(text='Answer',command=answer).pack(fill=X)

mainloop()

9. python簡單還是易語言簡單

一個是英文的,另一個是中文的,你說呢?
比如Python寫個提示信息:

def showMsg(): #提示框
tkinter.messagebox.showinfo('提示', '信息內容')
tkinter.messagebox.showwarning('警告', '信息內容')
tkinter.messagebox.showerror('錯誤', '信息內容')
易語言寫個提示信息:
信息框(「中文簡單嗎?」,#信息圖標,「消息」,)
信息框(「中文簡單嗎?」,#警告圖標,「消息」,)
信息框(「中文簡單嗎?」,#錯誤圖標,「消息」,)
那個語言簡單些,你覺得呢?

10. Python為什麼出現了error

你的教程是python2的,你自己安裝的是python3.
python3的print變成了函數
要print('hello world')這樣使用

閱讀全文

與pythonshowerror相關的資料

熱點內容
數學奇跡神奇運演算法 瀏覽:359
大廠的程序員的水平如何 瀏覽:700
遺傳演算法入門經典書籍 瀏覽:878
源碼炮台腳本 瀏覽:620
在位編輯命令 瀏覽:347
曲式分析基礎教程pdf 瀏覽:14
php生成靜態html頁面 瀏覽:964
怎麼分割pdf 瀏覽:812
壓縮垃圾報警器 瀏覽:629
小公司一般都用什麼伺服器 瀏覽:968
java獲取時間gmt時間 瀏覽:820
為什麼csgo一直連接不到伺服器 瀏覽:504
安卓登ins需要什麼 瀏覽:836
機器人演算法的難點 瀏覽:226
全自動化編程 瀏覽:727
程序員高薪限制 瀏覽:693
壓縮圖片壓縮 瀏覽:75
美國發明解壓魔方 瀏覽:302
電腦怎麼備案網上伺服器 瀏覽:515
旅行商問題Python寫法 瀏覽:953