[閒聊] glade跑不出視窗 是哪兒出問題了?

看板Python作者 (迪.阿倫)時間14年前 (2011/07/12 10:49), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
http://imageshack.us/photo/my-images/705/gladef.jpg/ 上面是glade的小小介面 下面是我寫的程式碼 -------------------------code---------------------------- import sys try: import pygtk pygtk.require("2.0") except: pass try: import gtk import gtk.glade except: sys.exit(1) import time from time import sleep import os.path import pango import string import re class PyWinForm(object): def __init__(self): gladefile = os.path.join(os.path.dirname(__file__),"PyWinForm.glade") UI = gtk.glade.XML(gladefile) self.mainWindow = UI.get_widget("mainWindow") self.testButton = UI.get_widget("testButton") def main(self): gtk.main() if __name__ == "__main__": app = PyWinForm() app.main() ---------------------------------------------------------- 理論上 這樣應該要跑出一個視窗才對啊? 請問一下是哪兒出錯了? 他是有錯誤訊息跑出來啦 可是我也是看網路上 大概也都這樣的寫法.... ---------------------error message--------------- cmd /k C:\Python26\python.exe "D:\My Documents\Python Code\win_test.py" &EXIT Process started >>> (python.exe:2712): libglade-WARNING **: Expected <glade-interface>. Got <interface>. (python.exe:2712): libglade-WARNING **: did not finish in PARSER_FINISH state Traceback (most recent call last): File "D:\My Documents\Python Code\win_test.py", line 35, in <module> app = PyWinForm() File "D:\My Documents\Python Code\win_test.py", line 24, in __init__ UI = gtk.glade.XML(gladefile) RuntimeError: could not create GladeXML object <<< Process finished. ================ READY ================ 請問是不能產生 gladexml物件的關系嗎?? 可是網路上 也這樣寫 他就沒問題= =? 有大大知道問題點在哪兒嗎 謝謝各位先進們~~ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.47.7.13
文章代碼(AID): #1E6xOoFO (Python)
文章代碼(AID): #1E6xOoFO (Python)