本文整理汇总了Python中ScrolledText.configure方法的典型用法代码示例。如果您正苦于以下问题:Python ScrolledText.configure方法的具体用法?Python ScrolledText.configure怎么用?Python ScrolledText.configure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScrolledText
的用法示例。
在下文中一共展示了ScrolledText.configure方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: GredAboutBox
# 需要导入模块: import ScrolledText [as 别名]
# 或者: from ScrolledText import configure [as 别名]
class GredAboutBox(GatoDialogs.AboutBox):
def body(self, master):
self.resizable(0,0)
self.catIconImage = PhotoImage(data=GatoIcons.gred)
self.catIcon = Label(master, image=self.catIconImage)
self.catIcon.pack(side=TOP)
label = Label(master, text=GatoDialogs.crnotice1)
label.pack(side=TOP)
label = Label(master, font="Helvetica 10",
text=GatoDialogs.crnotice2, justify=CENTER)
label.pack(side=TOP)
color = self.config("bg")[4]
self.infoText = ScrolledText(master, relief=FLAT,
padx=3, pady=3,
background=color,
#foreground="black",
wrap='word',
width=60, height=12,
font="Times 10")
self.infoText.pack(expand=0, fill=X, side=BOTTOM)
self.infoText.delete('0.0', END)
self.infoText.insert('0.0', GatoGlobals.gLGPLText)
self.infoText.configure(state=DISABLED)
self.title("Gred - About")
示例2: App
# 需要导入模块: import ScrolledText [as 别名]
# 或者: from ScrolledText import configure [as 别名]
class App(Thread):
client = socket()
def __init__(self, master):
Thread.__init__(self)
frame = Frame(master)
frame.pack()
gframe = Frame(frame)
gframe.pack(anchor='w')
self.lblserver = Label(gframe, text="IP Server :")
self.txtserver = Entry(gframe,width=40)
self.lblserver.pack(side=LEFT)
self.txtserver.pack(side=LEFT)
self.lblport = Label(gframe, text="Port :")
self.txtport = Entry(gframe,width=40)
self.lblport.pack(side=LEFT)
self.txtport.pack(side=LEFT)
self.koneksi = Button(gframe, text='Connect', command=self.Connect).pack(side=LEFT)
self.gettext = ScrolledText(frame, height=10,width=100)
self.gettext.pack()
self.gettext.configure(state=DISABLED)
sframe = Frame(frame)
sframe.pack(anchor='w')
self.pro = Label(sframe, text="Client>>")
self.sendtext = Entry(sframe,width=80)
self.sendtext.focus_set()
self.sendtext.bind(sequence="<Return>", func=self.Send)
self.pro.pack(side=LEFT)
self.sendtext.pack(side=LEFT)
def Connect(self):
try:
self.client.connect((str(self.txtserver.get()), int(self.txtport.get())))
self.gettext.configure(state=NORMAL)
self.gettext.insert(END,'Start to Chat\n')
self.gettext.configure(state=DISABLED)
self.start()
except:
tkMessageBox.showinfo("Error", "Unconnected")
def Send(self, args):
self.gettext.configure(state=NORMAL)
text = self.sendtext.get()
if text=="": text=" "
self.gettext.insert(END,'Me >> %s\n'%text)
self.sendtext.delete(0,END)
self.client.send(text)
self.sendtext.focus_set()
self.gettext.configure(state=DISABLED)
self.gettext.see(END)
def run(self):
Receive(self.client, self.gettext)
def __del__(self):
self.client.close()
示例3: App
# 需要导入模块: import ScrolledText [as 别名]
# 或者: from ScrolledText import configure [as 别名]
class App(Thread):
server = socket()
server.bind(('localhost', input("Port: ")))
server.listen(5)
client,addr = server.accept()
def __init__(self, master):
Thread.__init__(self)
frame = Frame(master)
frame.pack()
self.gettext = ScrolledText(frame, height=10,width=100, state=NORMAL)
self.gettext.pack()
sframe = Frame(frame)
sframe.pack(anchor='w')
self.pro = Label(sframe, text="Server>>");
self.sendtext = Entry(sframe,width=80)
self.sendtext.focus_set()
self.sendtext.bind(sequence="<Return>", func=self.Send)
self.pro.pack(side=LEFT)
self.sendtext.pack(side=LEFT)
self.gettext.insert(END,'Welcome to Chat\n')
self.gettext.configure(state=DISABLED)
def Send(self, args):
self.gettext.configure(state=NORMAL)
text = self.sendtext.get()
if text=="": text=" "
self.gettext.insert(END,'Me >> %s \n'%text)
self.sendtext.delete(0,END)
self.client.send(text)
self.sendtext.focus_set()
self.gettext.configure(state=DISABLED)
self.gettext.see(END)
def run(self):
Receive(self.client, self.gettext)
示例4: App
# 需要导入模块: import ScrolledText [as 别名]
# 或者: from ScrolledText import configure [as 别名]
class App(Thread):
client = socket()
print ("CLIENT")
client.connect((input("IP Server: "), input("Port: ")))
def __init__(self, master):
Thread.__init__(self)
frame = Frame(master)
frame.pack()
self.gettext = ScrolledText(frame, height=10,width=100)
self.gettext.pack()
self.gettext.insert(END,'Welcome to Chat\n')
self.gettext.configure(state=DISABLED)
sframe = Frame(frame)
sframe.pack(anchor='w')
self.pro = Label(sframe, text="Client>>");
self.sendtext = Entry(sframe,width=80)
self.sendtext.focus_set()
self.sendtext.bind(sequence="<Return>", func=self.Send)
self.pro.pack(side=LEFT)
self.sendtext.pack(side=LEFT)
def Send(self, args):
self.gettext.configure(state=NORMAL)
text = self.sendtext.get()
if text=="": text=" "
self.gettext.insert(END,'Me >> %s\n'%text)
self.sendtext.delete(0,END)
self.client.send(text)
self.sendtext.focus_set()
self.gettext.configure(state=DISABLED)
self.gettext.see(END)
def sendFile(self,sock,file):
sock.send(filFlag)
user = os.environ['USER']
command = filFlag
size = os.stat(file)[6]
f = open(file,'r')
pos = 0
while 1:
if pos == 0:
buffer = f.read(5000000-282)
if not buffer: break
count = sock.send(command + ':' + \
string.rjust(os.path.basename(file),214) + ':' + \
string.rjust(str(size).strip(),30) + ':' + \
string.rjust(str(user).strip(),30) + \
buffer)
pos = 1
else:
buffer = f.read(5000000)
if not buffer: break
count = sock.send(buffer)
def recvFile(self,sock):
pjg = 0
msg1 = sock.recv(283).split(':')
flag = msg1[0].strip()
namafile = msg1[1].strip()
total = msg1[2].strip()
user = msg1[3].strip()
file = namafile
if flag == filFlag:
try:
f = open(file,'w')
except:
ret = 0
print 'Tidak dapat menyimpan file'
sys.exit()
else:
try:
while 1:
leftToRead = int(total) - pjg
if not leftToRead: break
msg = sock.recv(5000000)
pjg = pjg + len(msg)
f.write(msg)
os.system('echo -n !')
f.close()
except:
os.remove(file)
ret = 0
else:
ret = 1
def run(self):
Receive(self.client, self.gettext)
示例5: App
# 需要导入模块: import ScrolledText [as 别名]
# 或者: from ScrolledText import configure [as 别名]
class App(Thread):
server = socket()
print("SERVER")
server.bind((input("IP Client: "), input("Port: ")))
server.listen(5)
client, addr = server.accept()
def __init__(self, master):
Thread.__init__(self)
frame = Frame(master)
frame.pack()
self.gettext = ScrolledText(frame, height=10, width=100, state=NORMAL)
self.gettext.pack()
sframe = Frame(frame)
sframe.pack(anchor="w")
self.pro = Label(sframe, text="Server>>")
self.sendtext = Entry(sframe, width=80)
self.sendtext.focus_set()
self.sendtext.bind(sequence="<Return>", func=self.Send)
self.pro.pack(side=LEFT)
self.sendtext.pack(side=LEFT)
self.gettext.insert(END, "Welcome to Chat\n")
self.gettext.configure(state=DISABLED)
def Send(self, args):
self.gettext.configure(state=NORMAL)
text = self.sendtext.get()
if text == "":
text = " "
self.gettext.insert(END, "Me >> %s \n" % text)
self.sendtext.delete(0, END)
self.client.send(text)
self.sendtext.focus_set()
self.gettext.configure(state=DISABLED)
self.gettext.see(END)
def sendFile(self, sock, file):
sock.send(filFlag)
user = os.environ["USER"]
command = filFlag
size = os.stat(file)[6]
try:
f = open(file, "r")
except:
ret = 0
else:
pos = 0
while 1:
if pos == 0:
buffer = f.read(5000000 - 282)
if not buffer:
break
count = sock.send(
command
+ ":"
+ string.rjust(os.path.basename(file), 214)
+ ":"
+ string.rjust(str(size).strip(), 30)
+ ":"
+ string.rjust(str(user).strip(), 30)
+ buffer
)
pos = 1
else:
buffer = f.read(5000000)
if not buffer:
break
count = sock.send(buffer)
ret = 1
return ret
def recvFile(self, sock):
pjg = 0
msg1 = sock.recv(283).split(":")
flag = msg1[0].strip()
namafile = msg1[1].strip()
total = msg1[2].strip()
user = msg1[3].strip()
file = namafile
if flag == filFlag:
try:
f = open(file, "w")
except:
ret = 0
else:
try:
while 1:
leftToRead = int(total) - pjg
if not leftToRead:
break
msg = sock.recv(5000000)
pjg = pjg + len(msg)
f.write(msg)
f.close()
except:
os.remove(file)
ret = 0
else:
ret = 1
ret = 1
#.........这里部分代码省略.........
示例6: construct
# 需要导入模块: import ScrolledText [as 别名]
# 或者: from ScrolledText import configure [as 别名]
def construct():
sample_prog = '''int main (void)
{
int x;
int y;
x = (1 + 2) * (3 / 4);
y = 1 + 2 * 3 - 4 / 5;
return x + y;
}'''
def callback():
input = inputBox.get(1.0, END)
# Lexical tab
message, output, tokens = lexical(input)
lexTab = tabs['Lexical']
lexTab.configure(state=NORMAL)
lexTab.delete(1.0, END)
lexTab.insert(INSERT, message + output)
lexTab.configure(state=DISABLED)
# Syntax tab
message, output, root, syn_pass = syntax(tokens)
synTab = tabs['Syntax']
synTab.configure(state=NORMAL)
synTab.delete(1.0, END)
synTab.insert(INSERT, message + output)
synTab.configure(state=DISABLED)
# Semantics tab
if syn_pass:
message = semantic(root)
else:
message = "Couldn't perform semantic analysis"
semTab = tabs['Semantics']
semTab.configure(state=NORMAL)
semTab.delete(1.0, END)
semTab.insert(INSERT, message)
semTab.configure(state=DISABLED)
master = Tk()
master.title("C- Compiler")
# Frames
buttonFrame = Frame(master)
buttonFrame.grid(row=1, column=1)
# Labels
Label(master, text="Input").grid(row=0, column=0)
Label(master, text="Output").grid(row=0, column=1)
# Buttons
compileButton = Button(buttonFrame, text='Compile', command=callback)
compileButton.grid(row=0, column=0)
# Text Boxes
inputBox = ScrolledText(master, width=50, height=40)
inputBox.grid(row=2, column=0)
inputBox.insert(INSERT, sample_prog)
# Notebook to hold tabs
notebook = ttk.Notebook(master)
notebook.grid(row=2, column=1)
tabs = {"Lexical": [], "Syntax": [], "Semantics": []}
tab_order = ["Lexical", "Syntax", "Semantics"]
for tabname in tab_order:
tab = ScrolledText(notebook, width=50, height=40)
tab.configure(state=DISABLED)
tabs[tabname] = tab
notebook.add(tab, text=tabname)
master.mainloop()