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


Python Ball.score方法代码示例

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


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

示例1: Paddle

# 需要导入模块: from Ball import Ball [as 别名]
# 或者: from Ball.Ball import score [as 别名]
# bd = 0 and highlightthickness = 0 make sure that there isn't a border around the screen
canvas = Tkinter.Canvas(top, width=500, height=400, bd=0, highlightthickness=0)
# Tells the canvas to size itself according to the width and height parameters we pass in line 17
canvas.pack()
# Tells Tkinter to initialize itself
top.update()

# Creates an object named 'paddle' of the Paddle class that we created in Paddle.py
paddle = Paddle(canvas, 'blue')
# Creates an object named 'ball' of the Ball class that we created in Ball.py
ball = Ball(canvas, paddle, 'red')

current_score = 0

# Creates the label for the score
score = Tkinter.Label(canvas, text= ball.score())

# Displays that window
canvas.create_window(10, 20, window=score, anchor='w')


# Tells the canvas to not loop through the listed command until the user close the window
while 1:

	
	# Calls the draw function on the ball as long as hit_bottom is False
	ball.draw()
	# Calls the draw function on the paddle as long as hit_bottom is False
	paddle.draw()

	# Updates the score
开发者ID:NTomtishen,项目名称:src,代码行数:33,代码来源:Bounce.py


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