我正在用 Tkinter 开发 reStructuredText 编辑器。如果我运行下面的代码,我得到IndentationError ..
from Tkinter import *
from tkFileDialog import asksaveasfile as savefile
class RSTkinter:
def __init__(self):
self.pencere_load()
self.araclar()
def pencere_load(self):
pencere.resizable(width=FALSE,height=FALSE)
pencere.title("RSTkinter")
def araclar(self):
h1 = Button(text=u"Başlıklar",command=self.h1p)
h1.place(rely=0.0)
..
..
topic = Button(text="Topic",command=self.topic_p) # ..topic:: başlık \n\t içerik
topic.place(rely=0.0,relx=0.63)
def topic_p(self):
topic = Toplevel()
topic.title("RSTkinter - Not")
topic.resizable(width=FALSE,height=FALSE)
topic.geometry("200x140")
topic_b_l = Label(topic,text=u"Topic başlığı: ")
topic_b_l.place(relx=0.0,rely=0.0)
self.topic_b = Text(topic)
self.topic_b.place(relx=0.3,rely=0.0,width=130)
topic_i_l = Label(topic,text=u"Topiç içeriği")
topic_i_l.place(relx=0.0,rely=0.4)
self.topic_i = Text(topic)
self.topic_i.place(relx=0.3,rely=0.5,width=130)
topic_y = Button(topic,text=u"Ekle",command=self.topic_yap)
topic_y.place(relx=0.0,rely=0.2)
def topic_yap(self):
return self.metin.insert(END,"\n.. topic:: %s \n\t%s"%(self.topic_b.get(1.0,END)),self.topic_i.get(1.0,END)))
pencere = Tk()
rst = RSTkinter()
mainloop()
完整错误:
File "RSTkinter15.py", line 85
topic = Button(text="Topic",command=self.topic_p) #.. ^
IndentationError: unexpected indent
我能怎么做?