No Description

tt.py 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. from Tkinter import *
  2. def response(event):
  3. I = event.widget['text']
  4. texts = UPN.text.get(1.0,END+'-1c')
  5. #print texts
  6. if I == 'DEL':
  7. UPN.text.delete(INSERT + '-1c',INSERT)
  8. elif I == 'Clear':
  9. UPN.text.delete(1.0,END)
  10. elif I == 'Enter':
  11. PolishStyleGui.text.insert(INSERT,'\n')
  12. elif I == '=':
  13. s = toList(texts)
  14. #print s
  15. UPN.text.insert(END,'\n=\n')
  16. UPN.text.insert(END,f(s))
  17. UPN.text.see('end')
  18. def UPN():
  19. root.title('umgekehrte polnische Notation')
  20. root.resizable(False,False)
  21. root.geometry('400x500+200+100')
  22. UI = LabelFrame(root)
  23. UI.place(x = 1,y = 1,width = 398,height = 124)
  24. UPN.text = Text(UI)
  25. UPN.text.place(x=1,y=1,width=390,height=116)
  26. Li=[['7','8','9','+','DEL'],
  27. ['4','5','6','-','Enter'],
  28. ['1','2','3','*','='],
  29. ['0','00','.','/','Clear']]
  30. for i in range(len(Li[0])):
  31. for j in range(len(Li)):
  32. bt = Button(root)
  33. bt.place(x=(i+1)*60,y=120+(j+1)*60,width=50,height=50)
  34. bt['text'] = Li[j][i]
  35. bt.bind('<Button-1>',response,add=(root,))