2012-11-01 3 views
1

처음 절반의 GUI 프로그램을 만들려고하고 있는데 tkinter을 사용하고 있지만 왜 작동하지 않는지 알 수 없습니다. 나는 1 (\ X31)를 누르면키 누름을 감지하는 것이 tkinter에서 작동하지 않습니다.

import Tkinter 
import tkMessageBox 
import os 
from Tkinter import * 
import Tkinter 
import tkMessageBox 

root = Tkinter.Tk() 

#text 

text = Text(root) 
text.insert(INSERT, "EASY hacktool for Linux\n\n1.john\n2.Crack wep\n3.Crack wpa/wpa2\n q to quit\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n\n\n\n\n\n\n\n\n",) 
text.tag_add("here", "1.0", "25.50") 
text.tag_config("here", background="black", foreground="green") 
text.pack() 


def key(event): 
    if event.keysym == 'q': 
     root.destroy() 
    elif event.keysym == '\x31': 
     os.system("python Gui/john.py") 
    elif event.keysym == '\x32': 
     os.system("python Gui/aircrack.py") 

root.bind_all('<Key>', key) 


root.mainloop() 

, 그것은 완벽하게 작동하지만이 '2'(\ X32)를 누르면, 아무것도 내 aircrack.py을 시도, 발생하지 않으며, 작동,하지만 아무튼 '티. 난 그냥 몇 가지 인쇄 문

os.system("python Gui/aircrack.py") 

를 교체 할 경우

+0

다른 파일에서 파이썬 코드에 액세스하려면'import gui.john;을 사용하는 것이 더 유용 할 것입니다. gui.john.foo' – FabienAndre

답변

0

코드는 당신을 위해 작동합니까 ... 나를 위해 잘 작동? aircrack.py는 동일한 경로에 있는지 확인하십시오.

관련 문제