当前位置: 首页>>代码示例>>Python>>正文


Python ScrolledText.yview_scroll方法代码示例

本文整理汇总了Python中ScrolledText.yview_scroll方法的典型用法代码示例。如果您正苦于以下问题:Python ScrolledText.yview_scroll方法的具体用法?Python ScrolledText.yview_scroll怎么用?Python ScrolledText.yview_scroll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ScrolledText的用法示例。


在下文中一共展示了ScrolledText.yview_scroll方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: skulltagBotWindow

# 需要导入模块: import ScrolledText [as 别名]
# 或者: from ScrolledText import yview_scroll [as 别名]

#.........这里部分代码省略.........
			self.outputText.insert(END, output)		#put it in the main window
			self.outputText.scan_mark(100000, 1)
			self.outputText.scan_dragto(10, 1)
			try:
				lscbot = stbehaviour.LSCParserBot(output, copy.deepcopy(self.players), *self.flags[:])
				chatText = lscbot.get()
						
				if chatText[0]:
					self.skulltag.stdin.flush()
					self.skulltag.stdin.write("say " + chatText[0] + '\n')
				
				self.flags = chatText[2:]
			except:
				import traceback
				print "%s\n%s" % (sys.exc_info()[0], sys.exc_info()[1])
				print traceback.print_tb(sys.exc_info()[2])
				self.cquit()
			self.outputText.config(state=DISABLED)
			self.inQLock.release()
		
		try:										#now for output
			output = self.outputQueue.get(block=0)
		except Queue.Empty:
			pass
		else:
			self.outQLock.acquire()
			self.skulltag.stdin.write(output)
			self.skulltag.stdin.flush()
			self.outQLock.release()
		self.after(5, self.rwLoop, (None,))
	
	def readLine(self):
		output = ''
		scrollAmount = 0
		if self.skulltag.poll():
			output = '\n\n - Terminated - '
			sys.exit()
		else:
			pollin = self.stdinPoll.poll(1)
			while pollin:
				pollin = pollin[0]
				if pollin[1] == 1:
					self.skulltag.stdout.flush()
					output += self.skulltag.stdout.readline()
					scrollAmount += 1
				pollin = self.stdinPoll.poll(1)
		
		if output == 'NETWORK_LaunchPacket: Permission denied\n' or output == 'NETWORK_LaunchPacket: Address 192.168.1.255:15101\n':
			output = ''
		
		if output:
			self.outputText.yview_scroll(16*((len(output)/80)+1)+(scrollAmount*16), 'pixels')
			
		self.inputQueue.put(output)
	
	def upOneHist(self, deadArg):
		if self.historyMarker <= -len(self.history):
			return
		
		self.historyMarker -= 1
		self.inputText.delete(0, END)
		self.inputText.insert(END, self.history[self.historyMarker])
		
	def downOneHist(self, deadArg):
		if self.historyMarker >= -1:
			self.inputText.delete(0, END)
			self.historyMarker = 0
			return
		
		self.historyMarker += 1
		self.inputText.delete(0, END)
		self.inputText.insert(END, self.history[self.historyMarker])
		
	def writeLine(self, deadArg):
		self.inputText.insert(END, ' ')
		output = self.inputTextText.get()
		self.history += [output[:-1]]
		self.historyMarker = 0
		if output[0] == ':':
			output = 'say ' + output[1:]
		if output.strip() == 'reset_lscbot':
			self.inputText.delete(0, END)
			self.skulltag.stdin.write("say Resetting the LSC Bot - should be a second\n")
			self.skulltag.stdin.flush()
			reload(stbehaviour)
			self.skulltag.stdin.write("say or less\n")
			self.skulltag.stdin.flush()
		else:
			self.inputText.delete(0, END)
			self.outputQueue.put(output)
				
		
	def cquit(self):
		for i in range(32):
			self.skulltag.stdin.write("kick_idx %s \" -- Server quit by host -- \"\n" % (i + 1))
			self.skulltag.stdin.flush()
		self.skulltag.stdin.write("error_fatal \"-- Server quit by host --\"")
		time.sleep(1)
		self.skulltag.terminate()
		self.quit()
开发者ID:IjonTichy,项目名称:PythonTidbits,代码行数:104,代码来源:sttest.py


注:本文中的ScrolledText.yview_scroll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。