老师叫啥没听清
File "F:\python\lib\tkinter\__init__.py", line 1421, in bind return self._bind(('bind', self._w), sequence, func, add) File "F:\python\lib\tkinter\__init__.py", line 1375, in _bind self.tk.call(what + (sequence, cmd)) _tkinter.TclError: no events specified in binding
老师,出现这个报错怎么办?我去百度了,但是看不明白他们是怎么做的。
老师我想问一下我按下空格还是会停止移动,我代码和你代码一样的
pygametime SCREEN_WIDTH=SCREEN_HEIGHT=BG_COLOR=pygame.Color() text_COLOR=pygame.Color() MainGame(): window=my_tank=(): (): pygame.display.init() MainGame.window=pygame.display.set_mode([SCREEN_WIDTHSCREEN_HEIGHT]) MainGame.my_tank=Tank() pygame.display.set_caption() : time.sleep() MainGame.window.fill(BG_COLOR) .getEvent() MainGame.window.blit(.getTextSuface(%)()) MainGame.my_tank.displayTank() MainGame.my_tank.stop: MainGame.my_tank.move() pygame.display.update() (): () () (text): pygame.font.init() font=pygame.font.SysFont() textSuface=font.render(texttext_COLOR) textSuface (): eventList=pygame.event.get() event eventList: event.type == pygame.QUIT: .endGame() event.type == pygame.KEYDOWN: event.key == pygame.K_LEFT: MainGame.my_tank.direction = MainGame.my_tank.stop=() event.key == pygame.K_RIGHT: MainGame.my_tank.direction = MainGame.my_tank.stop = () event.key == pygame.K_UP: MainGame.my_tank.direction = MainGame.my_tank.stop = () event.key == pygame.K_DOWN: MainGame.my_tank.direction = MainGame.my_tank.stop = () event.key==pygame.K_SPACE: () event.type == pygame.KEYUP: event.key==pygame.K_UP pygame.K_DOWN pygame.K_RIGHT pygame.K_RIGHT: MainGame.my_tank.stop = Tank(): (lefttop): .images = {: pygame.image.load(): pygame.image.load(): pygame.image.load(): pygame.image.load() } .direction=.image=.images[.direction] .rect=.image.get_rect() .rect.left=left .rect.top=top .speed=.stop=(): (): .direction == : .rect.left > : .rect.left -= .speed .direction == : .rect.right < : .rect.right += .speed .direction == : .rect.top+.rect.height < : .rect.top += .speed .direction == : .rect.top>: .rect.top -= .speed (): .image=.images[.direction] MainGame.window.blit(.image.rect) Mytank(Tank): (): Enemytank(Tank): (): Bullet(): (): (): (): Wall(): (): (): Music(): (): (): Explode(): (): (): __name__==: MainGame().startGame()
老师我想问一下我把这个改成0.02后下和右就不能移动,左和上可以是为什么,
老师我想问一下我右边可以停下来,下面不可以按照我这样直接写屏幕大小
老师,这两个地方写root和self有什么区别啊
为什么我自己的gif文件调用的时候会显示couldn't recognize data in image file "imgs/1.gif"
pygame SCREEN_WIDTH=SCREEN_HEIGHT=BG_COLOR=pygame.Color() MainGame(): window=(): (): pygame.display.init() MainGame.window=pygame.display.set_mode([SCREEN_WIDTHSCREEN_HEIGHT]) pygame.display.set_caption() : MainGame.window.fill(BG_COLOR) .getEvent() pygame.display.update() (): () () (): pygame.font.init() (pygame.font.get_fonts()) (): eventList=pygame.event.get() event eventList: event.type == pygame.QUIT: .endGame() event.type == pygame.KEYDOWN: event.key == pygame.K_LEFT: () event.key == pygame.K_RIGHT: () event.key == pygame.K_UP: () event.key == pygame.K_DOWN: () Tank(): (): (): (): (): Mytank(Tank): (): Enemytank(Tank): (): Bullet(): (): (): (): Wall(): (): (): Music(): (): (): Explode(): (): (): __name__==: MainGame().getTextSuface()
代码在这里
老师我查看所有字体怎么会这样,照着敲代码的
那些方法是否有必要去记吗
打印不了上下老师
pygame SCREEN_WIDTH=SCREEN_HEIGHT=BG_COLOR=pygame.Color() MainGame(): window=(): (): pygame.display.init() MainGame.window=pygame.display.set_mode([SCREEN_WIDTHSCREEN_HEIGHT]) pygame.display.set_caption() : MainGame.window.fill(BG_COLOR) .getEvent() pygame.display.update() (): () () (): eventlist=pygame.event.get() event eventlist: event.type == pygame.QUIT: .endGame() event.type == pygame.KEYDOWN: event.type == pygame.K_LEFT: () event.type == pygame.K_RIGHT: () event.type == pygame.K_UP: () event.type == pygame.K_DOWN: () Tank(): (): (): (): (): Mytank(Tank): (): Enemytank(Tank): (): Bullet(): (): (): (): Wall(): (): (): Music(): (): (): Explode(): (): (): __name__==: MainGame().startGame()
老师,我对这里的master的整个过程不是很理解,能解释一下吗,master在这里怎么接受到下面的信息的root信息的?
使用write和writelines写入数据有什么区别
老师 这里为什么设计y=30和50?变化的不是x的值吗?、
非常抱歉给您带来不好的体验!为了更深入的了解您的学习情况以及遇到的问题,您可以直接拨打投诉热线:
我们将在第一时间处理好您的问题!
关于
课程分类
百战程序员微信公众号
百战程序员微信小程序
©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园网站维护:百战汇智(北京)科技有限公司 京公网安备 11011402011233号 京ICP备18060230号-3 营业执照 经营许可证:京B2-20212637