会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132906个问题

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<table align="center" border="1" width="500" height="500">
    <tr>
        <td colspan="2"></td>
        <td rowspan="2"></td>
    </tr>
    <tr>
        <td rowspan="2"></td>
        <td></td>
    </tr>
    <tr>
        <td colspan="2"></td>
    </tr>
</table>
<hr>
<table border="10" align="center" width="600" >
    <caption>学生信息表</caption>
    <tr>
        <th colspan="3">学生基本信息</th>
        <th colspan="2">成绩</th>
    </tr>
    <tr>
        <th>姓名</th>
        <th>性别</th>
        <th>专业</th>
        <th>课程</th>
        <th>分数</th>
    </tr>
    <tr align="center">
        <td>球球</td>
        <td>男</td>
        <td rowspan="2">计算机</td>
        <td rowspan="3">程序设计</td>
        <td>68</td>
    </tr>
    <tr align="center">
        <td>楠楠</td>
        <td>女</td>
        <td>89</td>
    </tr>
    <tr align="center">
        <td>小明</td>
        <td>男</td>
        <td>会计</td>
        <td>68</td>
    </tr>
    <tr align="center">
        <td>小明</td>
        <td>男</td>
        <td>建筑</td>
        <td>建筑设计</td>
        <td>68</td>
    </tr>
</table>
</body>
</html>

image.png

WEB前端全系列/第一阶段:HTML5+CSS3模块/HTML5基础元素 21167楼

老师,你看下为什么会报错用户不存在,数据库设置和 代码如下:

db.properties

jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/liyang
jdbc.username=root
jdbc.password=li134584

mybatis-cfg.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration
        PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
        "http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
    <!--引入 db.properties 属性文件-->
    <properties resource="db.properties"/>
    <!--配置别名-->
    <typeAliases>
        <package name="com.liyang.pojo"/>
    </typeAliases>
    <!--配置环境-->
    <environments default="development">
        <environment id="development">
            <transactionManager type="JDBC"></transactionManager>
            <dataSource type="POOLED">
                <property name="driver" value="${jdbc.driver}"/>
                <property name="url" value="${jdbc.url}"/>
                <property name="username" value="${jdbc.username}"/>
                <property name="password" value="${jdbc.password}"/>
            </dataSource>
        </environment>
    </environments>
    <!--引入 Mapper 映射配置文件-->
    <mappers>
        <package name="com.liyang.mapper"/>
    </mappers>
</configuration>

JAVA 全系列/第六阶段:项目管理与SSM框架/Mybatis 21168楼
JAVA 全系列/第一阶段:JAVA 快速入门/IDEA的使用和第一个java项目 21169楼
JAVA 全系列/第三阶段:数据库编程/SQL 语言 21170楼
JAVA 全系列/第十一阶段:分布式RPC调用和分布式文件存储/Dubbo 21171楼

老师,我这个路径不知道为什么报错,因为我以前也是这么放的没有报错,而且这个是相同路径啊,代码在最下面

image.png

#coding=utf-8
"""测试label写法,采用面向对象的方式"""

from tkinter import *
from tkinter import messagebox

class Application(Frame):#定义Application类,继承Frame类
    def __init__(self,master = None):
        super().__init__(master)#调用父类的构造方法
        self.master = master
        self.pack()#当框架中存放了组件时,就需要调用self.pack()进行组件的摆放
        self.creatWidget()

    def creatWidget(self):
        """创建组件"""
        self.label01 = Label(self,text="baizhan哦",width=10,height=2,
                             bg="yellow",fg="blue",font=("楷体",25))
        self.label01.pack()
        self.label02 = Label(self, text="bug好多", borderwidth=5,
                             relief="groove",justify="center")
        self.label02.pack()
        global photo#将photo声明为全局变量,如果是局部变量,本算法执行后图像对象销毁,窗口不显示图像
        photo = PhotoImage(file="1.gif")
        self.label03 = Label(self,image = photo)
        self.label03.pack()

if __name__ == "__main__":#若是本程序使用,非被调用
    root = Tk()#设置主窗口
    root.geometry("400x400+100-100")#设置窗口大小
    root.title("一个经典的gui程序类的测试")
    app = Application(master = root)

    root.mainloop()


Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 21174楼

# 导入pygame模块
import pygame
 
SCREEN_WIDTH = 700
SCREEN_HEIGHT = 500
BG_COLOR = pygame.Color(0, 0, 0)
 
 
class MainGame():
    window = None
 
    def __init__(self):
        pass
 
    # 开始游戏
    def startGame(self):
        # 加载主窗口
        # 初始化窗口
        pygame.display.init()
        # 设置窗口的大小及显示
        MainGame.window = pygame.display.set_mode([SCREEN_WIDTH, SCREEN_HEIGHT])
        # 设置窗口的标题
        pygame.display.set_caption("坦克大战1.03")
        while True:
            # 设置填充色
            MainGame.window.fill(BG_COLOR)
            #获取事件
            self.getEvent()
            pygame.display.update()
 
    # 结束游戏
    def endGame(self):
        print("谢谢使用,欢迎再次使用")
        exit()
 
    #获取事件
    def getEvent(self):
        #获取所有事件
        eventList=pygame.event.get()
        #遍历事件
        for event in eventList:
            #判断按下的键是关闭还是键盘按下
            #如果按的是退出,关闭窗口
            if event.type==pygame.QUIT:
                self.endGame()
            #如果是键盘的按下
            if event.type==pygame.KEYDOWN:
                #判断按下的是上、是下、左、右
                if event.type==pygame.K_LEFT:
                    print("按下左键,坦克向左移动")
                elif event.type==pygame.K_RIGHT:
                    print("按下右键,坦克向右移动")
                elif event.type==pygame.K_UP:
                    print("按下上键,坦克向上移动")
                elif event.type==pygame.K_DOWN:
                    print("按下下键,坦克向下移动")

请问老师:

    遍历的目的是持续捕捉对象吗?和mainloop()一样吗?

Python 全系列/第二阶段:Python 深入与提高/游戏开发-坦克大战 21175楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

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