fork(1) download
  1. from Tkinter import *
  2. from random import randrange
  3.  
  4. class Pole(Canvas):
  5. def __init__(self,rows,cols,size):
  6. self.rows=rows
  7. self.cols=cols
  8. self.size=size
  9. width_g=cols*size
  10. height_g=rows*size
  11. Canvas.__init__(self,relief=RIDGE, borderwidth=2, width=width_g, height=height_g)
  12. A=range(rows+1)
  13. for i in range(rows):
  14. A[i]=range(cols)
  15. for i in range(rows):
  16. for j in range(cols):
  17. A[i][j]=0
  18. x=j*size
  19. y=i*size
  20. x1=x+size
  21. y1=y+size
  22. self.create_rectangle(x,y,x1,y1, fill=colors[0],tag='pole')
  23. self.data=A
  24. def ris(self):
  25. for i in range(self.rows):
  26. for j in range(self.cols):
  27. x=j*self.size
  28. y=i*self.size
  29. x1=x+self.size
  30. self.create_rectangle(x,y,x1,y1, fill=colors[self.data[i][j]],tag='pole')
  31. class Work:
  32. def __init__(self,rows=30,cols=15,size=15,delay=1000):
  33. self.ii=2
  34. self.jj=cols/2
  35. self.nf=1
  36. self.nf=randrange(len())
  37. for nk in [0,1,2,3]:
  38. x=(self.jj+fig_data[self.nf][nk][1])*size
  39. y=(self.ii+fig_data[self.nf][nk][0])*size
  40. x1=x+size
  41. y1=y+size
  42. pole.create_rectangle(x,y,x1,y1, fill=fig_data[self.nf][nk])
  43.  
  44. fig_data[self.nf]
  45.  
  46. def ris(self):
  47. for nk in [0,1,2,3]:
  48. s=(self.jj+self.B[nk][1])*self.size
  49. y=(self.ii+self.B[nk][0])*self.size
  50. x1=x+self.size
  51. y1=y+self.size
  52. pole.create_rectangle(x,y,x1,y1 fill=colors[self.B[4]],tag='cubs')
  53.  
  54. def move(self,i,j,):
  55. a=o
  56. for nk in 0,1,2,3:
  57. iii=self.ii+self.B[nk][0]
  58. jjj=self.jj+self.B[nk][1]
  59. if iii in range(pole.rows) and jjj in range(pole.cols)and pole.data[]
  60. #def f_top_top(event):
  61. #print'ryaaaaa!!!'
  62.  
  63. def keyPressed(event):
  64. if(event.keysym == "Up"):
  65. pass
  66. if(event.keysym == "Down"):
  67. pass
  68. if(event.keysym == "Left"):
  69. try:
  70. figa.jj-=1
  71. figa.jj.top_top()
  72. except Tupik:
  73. figa.jj+=1
  74. if(event.keysym == "Right"):
  75. pass
  76. elif (event.char == "g"):
  77. time_top()
  78.  
  79. okno=Tk()
  80. okno.title('Tetris')
  81.  
  82. ramka_1 =Frame(okno, relief=SOLID, borderwidth=3, width=300, height=600, bg='#9ACD32')
  83. ramka_2 =Frame(okno, width=300,bg='white')
  84.  
  85. ramka_1.pack(side=LEFT)
  86. ramka_2.pack(side=LEFT, fill=BOTH)
  87.  
  88. ramka_t=Frame(ramka_2, relief=GROOVE, borderwidth=3, width=250, height=100,bg='#FF69B4')
  89. ramka_t.pack(side=TOP)
  90. ramka_B=Frame(ramka_2, width=250, height=100,bg='#B22222')
  91. ramka_B.pack(side=BOTTOM)
  92.  
  93. pole=Pole(ramka_1,rows=18, cols=12, bit=20,color='#808080')
  94. pole.pack(side=LEFT, expand=1)
  95.  
  96. figa=Figa(15,15)
  97.  
  98. okno.bind("<Key>", KeyPressed)
  99.  
  100. #exort.create_oval(0,100,70,70, fill='deepskyblue')
  101.  
  102. but={}
  103.  
  104. but[1]=Button(ramka_B,text='START',command=my_start)
  105. but[2]=Button(ramka_B,text='EXIT',command=okno.destroy)
  106. but[3]=Button(ramka_B,text='CLEAR',command=my_clear)
  107. but[4]=Button(ramka_B,text='COLOR',command=my_color)
  108.  
  109. but[1].grid(row=0, column=0)
  110. but[2].grid(row=0, column=1)
  111. but[3].grid(row=1, column=0)
  112. but[4].grid(row=1, column=1)
  113.  
  114. okno.mainloop()
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/py_compile.py", line 117, in compile
    raise py_exc
py_compile.PyCompileError:   File "prog.py", line 52
    pole.create_rectangle(x,y,x1,y1 fill=colors[self.B[4]],tag='cubs')
                                       ^
SyntaxError: invalid syntax

stdout
Standard output is empty