会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 133791个问题
JAVA 全系列/第二十三阶段:分布式医疗云平台/项目环境准备 4621楼
Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 4622楼
JAVA 全系列/第十九阶段:亿级高并发电商项目/亿级高并发电商项目(旧) 4623楼
JAVA 全系列/第二阶段:JAVA 基础深化和提高/数据结构 4624楼

pygame,time
random
_display=pygame.display
COLOR_BLACK=pygame.Color(,,)
COLOR_RED=pygame.Color(,,)
():
    window=TANK_P1=SCREEN_HEIGHT=SCREEN_WIDTH=EnemyTank_list=[]
    EnemyTank_count=():
        ():
        _display.init()
        MainGame.window=_display.set_mode([MainGame.SCREEN_WIDTH,MainGame.SCREEN_HEIGHT])
        MainGame.TANK_P1 = Tank(, )
        .createEnemyTank()
        _display.set_caption()

        :
            time.sleep()
            MainGame.window.fill(COLOR_BLACK)
            .getEvent()
            MainGame.window.blit(.getTextface(%),(,))

            MainGame.TANK_P1.displayTank()

            .displayEnemyTank()
            MainGame.TANK_P1.stop == :
                MainGame.TANK_P1.move()
            _display.update()


    ():
        top = i (MainGame.EnemyTank_count):
            left = random.randint(, )
            speed = random.randint(, )
            eTank = EnemyTank(left, top, speed)
            MainGame.EnemyTank_list.append(eTank)


   ():
        eTank MainGame.EnemyTank_list:
            eTank.displayTank()
            eTank.randMove()

    ():
        ()
        ()

    (,text):
        pygame.font.init()
        font=pygame.font.SysFont(,)
        textSurface=font.render(text,,COLOR_RED)
        textSurface

():
        eventList=pygame.event.get()
        event eventList:
    event.type==pygame.QUIT:
                .endGame()
    event.type==pygame.KEYDOWN:
     event.key==pygame.K_LEFT:
                    ()
                    MainGame.TANK_P1.direction=MainGame.TANK_P1.stop=event.key==pygame.K_RIGHT:
                    ()
                    MainGame.TANK_P1.direction=MainGame.TANK_P1.stop=event.key == pygame.K_UP:
                        ()
                        MainGame.TANK_P1.direction = MainGame.TANK_P1.stop = event.key == pygame.K_DOWN:
                            ()
                            MainGame.TANK_P1.direction = MainGame.TANK_P1.stop = event.key==pygame.K_SPACE:
                    ()


             event.type==pygame.KEYUP:
                    event.key==pygame.K_LEFT event.key==pygame.K_RIGHT \
                        event.key == pygame.K_UP event.key==pygame.K_DOWN:
                     MainGame.TANK_P1.stop=():
    (,left,top):
        .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
        .stop = .speed=():
        .image=.images[.direction]
        MainGame.window.blit(.image,.rect)


():
        .direction==:
            .rect.left>:
                .rect.left-=.speed
        .direction==:
            .rect.left+.rect.width<MainGame.SCREEN_WIDTH:
                .rect.left+=.speed
        .direction==:
            .rect.top > :
                 .rect.top-=.speed
        .direction==:
            .rect.top + .rect.height< MainGame.SCREEN_HEIGHT:
                .rect.top += .speed

    ():
        ():
        ():
        (Tank):
    ():
        ():
        (Tank):

    (,left,top,speed):
        .images={
            :pygame.image.load(),
            :pygame.image.load(),
            :pygame.image.load(),
            :pygame.image.load()
        }
        .direction=.randDirection()
        .image=.images[.direction]
        .rect=.image.get_rect()
        .rect.left=left
        .rect.top=top
        .speed=speed
        .stop=.step=():
            num=random.randint(,)
            num==:
                 num == :
                num == :
                num == :
                ():
        .step<=:
            .direction=.randDirection()
            .step=:
            .move()
            .step-=():
        ():
    ():
        ():
        ():
        ():
        ():
        ():
        ():
    ():
        ():
        ():
    ():
        ():
        ():
    ():
        ():
        __name__==:
    MainGame().startGame()



报错

"C:\Program Files (x86)\Python36-32\python.exe" C:/Users/Administrator/Desktop/python课件/坦克游戏/代码/test/tank08.py

pygame 2.0.1 (SDL 2.0.14, Python 3.6.5)

Hello from the pygame community. https://www.pygame.org/contribute.html

Traceback (most recent call last):

  File "C:/Users/Administrator/Desktop/python课件/坦克游戏/代码/test/tank08.py", line 284, in <module>

    MainGame().startGame()

  File "C:/Users/Administrator/Desktop/python课件/坦克游戏/代码/test/tank08.py", line 28, in startGame

    self.createEnemyTank()

  File "C:/Users/Administrator/Desktop/python课件/坦克游戏/代码/test/tank08.py", line 59, in createEnemyTank

    eTank = EnemyTank(left, top, speed)

  File "C:/Users/Administrator/Desktop/python课件/坦克游戏/代码/test/tank08.py", line 208, in __init__

    self.image=self.images[self.direction]

KeyError: None


Process finished with exit code 1



老师,帮我看看是什么原因


Python 全系列/第二阶段:Python 深入与提高/游戏开发-坦克大战 4625楼
JAVA 全系列/第七阶段:项目管理与SSM框架/Mybatis 4626楼
Python 全系列/第六阶段:数据库与AI协同技术实战/mysql的使用 4627楼

springbootmybatis1.rar

老师帮忙看看,控制台报

org.thymeleaf.exceptions.TemplateInputException: Error resolving template [addUser], template might not exist or might not be accessible by any of the configured Template Resolvers

页面

image.png

JAVA 全系列/第九阶段:Spring Boot实战/Spring Boot 4628楼
JAVA 全系列/第八阶段:Linux入门到实战/Maven 4630楼
JAVA 全系列/第一阶段:AI驱动的JAVA编程/变量、数据类型、运算符 4631楼
JAVA 全系列/第七阶段:项目管理与SSM框架/Maven 4633楼

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
    </head>
    <body>
        
        <!--标题标签-->
        <h1 align="center">注册页面</h1>
        <!--分割线-->
        <hr/ width="400px" align="center">
        <!--
            表单标签<form>:
                align:可调表单位置
        -->
        <form align="center">
        
            <!--段落标签-->
            <p>
                用户名:<input type="text" placeholder="zhangsan" autofocus />
            </p>
            <p>
                密码:<input type="password" />                
            </p>
            <p>
                手机号:<input type="number" />
            </p>
            <p>
                邮箱:<input type="email" maxlength="11" minlength="11" />
            </p>
            <!--
                type属性:
                    radio:单选按钮
            -->
            <p>
                性别:男:<input type="radio" name="sex" checked="checked" /> 女:<input type="radio" name="sex" checked="checked" /> 
            </p>
            <p>
                爱好:<input type="checkbox"/>唱歌  <input type="checkbox" />睡觉  <input type="checkbox" />LOL<br/>
                    <input type="checkbox" />旅游  <input type="checkbox" />高尔夫  <input type="checkbox" />篮球
            </p>
            <!--下拉框选项-->
            籍贯:<select name="籍贯">
                <option value="1">中国</option>
                <option value="2" selected="selected">请选择</option>
                <option value="3">日本</option>
                <option value="4">新加坡</option>
            </select>
            <p>
            个人介绍:<textarea rows="15" cols="20"></textarea>
            </p>
            <p>
            <input type="checkbox" />是否同意本公司协议
            </p>   
            <p>
            <input type="submit" value="注册" />
            </p>
        </form>
        
    </body>
</html>

老师,你好,实操中的要求是这样:图片.png

然后我运行出来的是这样:(内容都有,但是排列不整齐,歪来歪去的有什么办法可以解决吗?,还有爱好那一栏的多选框,看着很难受,原生的html怎么才能做成上面那样)

图片.png

Python 全系列/第七阶段:网页编程基础/html5 4635楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

©2014-2025百战汇智(北京)科技有限公司 All Rights Reserved 北京亦庄经济开发区科创十四街 赛蒂国际工业园
网站维护:百战汇智(北京)科技有限公司
京公网安备 11011402011233号    京ICP备18060230号-3    营业执照    经营许可证:京B2-20212637