當前位置: 首頁>>代碼示例>>Python>>正文


Python Menu.currentMenu方法代碼示例

本文整理匯總了Python中Menu.Menu.currentMenu方法的典型用法代碼示例。如果您正苦於以下問題:Python Menu.currentMenu方法的具體用法?Python Menu.currentMenu怎麽用?Python Menu.currentMenu使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Menu.Menu的用法示例。


在下文中一共展示了Menu.currentMenu方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: Person

# 需要導入模塊: from Menu import Menu [as 別名]
# 或者: from Menu.Menu import currentMenu [as 別名]

#.........這裏部分代碼省略.........
			self.clickedSpot = map['coords']
			
	def rightClicked(self):
		return self.rightButton
			
			
	def clickedOn(self):
		return self.clicked
			
	def set_clickedOn_to_false(self):
		self.clicked = False
		
	def closingClick(self,map):
		if self.clicked == True and self.rect.collidepoint(map['coords']) == True and map['button'] == 'down' and map['button3'] == True:
				return True 

				
	def runWalkingPath(self):
		if self.menu.nameOfSelectedBox() == "walking":
			return True
		else:
			return False
		

	def getMenu(self,map):
		#print "1 ----"
		'''getMenu checks to see if you clicked on something on the menu. 
	
		   if you did, it sets clicked to false, so that on the next screen update, the menu
		   will not appear. '''
	
		if self.menu.clickedOn(map): #menu.clickedOn returns true if you clicked on one of the squares, and false otherwise
			self.clicked = False
		return self.menu.currentMenu(map,self.clickedSpot) #returns the current menu
		
		
		#is used to prevent making circles in the exact same place

			
	def selected(self):
		#print self.menu.selectedBox()
		temp = self.menu.selectedBox()
		##print "temp is: ",temp
		#self.setLTSelected(temp)
		return temp
		
	def resetSelected(self):
		return self.menu.resetSelectedBox()
		
	# def setLTSelected(self,string):# set long term selected
		# self.LTSelectedString = string
		
	# def getLTSelected(self):
		# #print "self.LTSelectedString is: ",self.LTSelectedString
		# return self.LTSelectedString
		
	def runAction(self):
		#print "7 ----"
		if self.selected() == "exit":
			#print "exit"
			self.closeMenu()
		if self.selected() == "walking":
			#print self.selected()
			#print "11------------------"
			self.which = "walking"
			self.closeMenu()
開發者ID:MichaelHaendler,項目名稱:python_video_game1,代碼行數:70,代碼來源:Person.py

示例2: __init__

# 需要導入模塊: from Menu import Menu [as 別名]
# 或者: from Menu.Menu import currentMenu [as 別名]
class WalkingGUI:

	def __init__(self):
		self.blend = 1
		self.clicked = False
		self.circles = []
		self.initialCircleAddedTF = False
		self.menu = Menu()
		self.menu.addChoice("walk")
		self.menu.addChoice("adjustCircle")
		self.menu.makeBasicMenu()
		self.rightButton = False # for displaying the (big)menu itself
		self.disCirMenu = False #display Circle Menu...for displaying the circle menu on a particular circle
		self.setTo = False #for showing the circles themselves
		self.oldTup = ()
		self.displayMenuAtLoc =(0,0)
		self.tempTupOfPath = []	

	def getMenu(self,map):		
		
		if self.menu.clickedOn(map): #menu.clickedOn returns true if you clicked on one of the squares, and false otherwise
			self.rightButton = False
			self.disCirMenu = False
		string = "here self.disCirMenu is22: ", str(self.disCirMenu)
		Objs2.tempSqs.add(string)
		return self.menu.currentMenu(map,self.displayMenuAtLoc)
		
	def clickedOn(self):
		return self.rightButton 
		
	def run(self):
		return self.setTo 
		
	def setToRun(self):
		self.setTo = True
		
	def stopRun(self):
		print "very bad"
		self.setTo = False
		
	def getAction(self):
		return self.menu.selectedBox()
		
	def resetAction(self):
		self.menu.resetSelectedBox()
		#self.which = "nothing11"
		
	def closeMenu(self):
		self.rightButton = False
		
	def closeCircleMenu(self):#check this out again
		self.disCirMenu = False
		

	def rightClickedACircle(self,map):
	
		#a silly, simple, and hacked way to keep this returning 
		# True so that the Menu doesn't disappear on the next iteration
		string = "self.disCirMenu is11: ", str(self.disCirMenu)
		Objs2.tempSqs.add(string)
		if self.disCirMenu == True:
			return True
				
		#print "bang" 
		for circle in self.circles:
			#print "zoom" 
			if circle.rightClickedOn(map) == True and circle.contains(map['coords']):
				self.displayMenuAtLoc = map['coords']
				self.disCirMenu = True
				return True
				
				
		return False
		#print "---------"
		#return False		
		
	def adjCirclePos(self,map,mouse):
		for circle in self.circles:
			if circle.leftClickedOn(map) and circle.contains(map['coords']):
				if len(self.oldCoords) == 0:
					self.oldCoords = new_tup
					circle.setColor(Color("blue"))
				else:
					new_coords = mouse.getLoc()
					#print "finally!"
					changeXby = new_coords[0] - self.oldCoords[0]
					changeYby = new_coords[1] - self.oldCoords[1]
					circle.adjLoc((changeXby,changeYby))
					old_tup = new_tup	
	
	def noLongerHoldingDownLeftButton(self):
		self.oldTup = ()
		circle.setColor("green")
		
	def hadBeenClickedOn(self,map):
		if len(self.oldTup) >= 1 and (map['button'] == "up" or map['button1'] == False):
			return True
		else:
			return False

#.........這裏部分代碼省略.........
開發者ID:MichaelHaendler,項目名稱:python_video_game1,代碼行數:103,代碼來源:WalkingGUI.py


注:本文中的Menu.Menu.currentMenu方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。