Selaa lähdekoodia

更新 'tt.py'

hzhu 7 vuotta sitten
vanhempi
commit
af1b0dd7e7
1 muutettua tiedostoa jossa 20 lisäystä ja 31 poistoa
  1. 20 31
      tt.py

+ 20 - 31
tt.py

@@ -1,34 +1,23 @@
1
-def toList(s):
1
+from Tkinter import *
2
+def UPN():    
3
+    root.title('umgekehrte polnische Notation')
4
+    root.resizable(False,False)
5
+    root.geometry('400x500+200+100')
2 6
 
3
-    L = []
4
-    for i in s:
5
-        if i != '\n':
6
-            L.append(i)
7
-    return L
7
+    UI = LabelFrame(root)
8
+    UI.place(x = 1,y = 1,width = 398,height = 124)
8 9
 
9
-def f(i,s,S = None):
10
-    
11
-    if not S:
12
-        S = []
13
-        
14
-    if i == len(s):
15
-        return S[0]
10
+    UPN.text = Text(UI)
11
+    UPN.text.place(x=1,y=1,width=390,height=116)
16 12
 
17
-    a = s[i]
18
-    if a.isdigit():
19
-        S.append(a)
20
-        return f(i+1,s,S)
21
-    else:
22
-        c = S.pop()
23
-        d = S.pop()
24
-        e = '%s%s%s'%(c,a,d)
25
-        S.append(eval(e))
26
-        return f(i+1,s,S)
27
-
28
-x = raw_input()
29
-s = ""
30
-while x != '=\n':
31
-    s += x
32
-    x = raw_input() + '\n'
33
-
34
-print f(0,toList(s))
13
+    Li=[['7','8','9','+','DEL'],
14
+        ['4','5','6','-','Enter'],
15
+        ['1','2','3','*','='],
16
+        ['0','00','.','/','Clear']]
17
+ 
18
+    for i in range(len(Li[0])):
19
+        for j in range(len(Li)):
20
+            bt = Button(root)
21
+            bt.place(x=(i+1)*60,y=120+(j+1)*60,width=50,height=50)
22
+            bt['text'] = Li[j][i]
23
+            bt.bind('<Button-1>',response,add=(root,))