会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132370个问题
Python 全系列/第十五阶段:Python 爬虫开发/爬虫反反爬 37471楼

在确认检查按钮按下后出现开始检查失败,后台控制台输出语句如下,应该怎么解决呢

Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2392771f] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@ff2f031] will not be managed by Spring
==>  Preparing: SELECT item_id,co_id,item_ref_id,item_name,item_type,num,price,amount,remark,status,create_time FROM his_care_order_item WHERE item_id=? 
==> Parameters: ITEM1363797224076738560(String)
<==    Columns: item_id, co_id, item_ref_id, item_name, item_type, num, price, amount, remark, status, create_time
<==        Row: ITEM1363797224076738560, CO1363797223476953088, 2, 血常规, 1, 1.00, 5.00, 5.00, 按要求检查, 1, 2021-02-22 10:26:11
<==      Total: 1
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@2392771f]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@72440f67] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@ff2f031] will not be managed by Spring
==>  Preparing: SELECT co_id,co_type,user_id,patient_id,patient_name,ch_id,all_amount,create_by,create_time,update_by,update_time FROM his_care_order WHERE co_id=? 
==> Parameters: CO1363797223476953088(String)
<==    Columns: co_id, co_type, user_id, patient_id, patient_name, ch_id, all_amount, create_by, create_time, update_by, update_time
<==        Row: CO1363797223476953088, 1, 2, HZ1363797038256488448, CC, CH1363797149741088768, 75.00, 扁鹊, 2021-02-22 10:26:11, , null
<==      Total: 1
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@72440f67]
Creating a new SqlSession
SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5955cb9f] was not registered for synchronization because synchronization is not active
JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@ff2f031] will not be managed by Spring
==>  Preparing: SELECT ch_id,user_id,user_name,patient_id,patient_name,dept_id,dept_name,receive_type,is_contagious,care_date,case_date,reg_id,case_title,case_result,doctor_tips,remark FROM his_care_history WHERE ch_id=? 
==> Parameters: CH1363797149741088768(String)
<==    Columns: ch_id, user_id, user_name, patient_id, patient_name, dept_id, dept_name, receive_type, is_contagious, care_date, case_date, reg_id, case_title, case_result, doctor_tips, remark
<==        Row: CH1363797149741088768, 2, 扁鹊, HZ1363797038256488448, CC, 101, 内科, 0, 0, 2021-02-22 10:25:53, 2021-02-22, GH1363797039326035968, cc, cc, cc, cc
<==      Total: 1
Closing non transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@5955cb9f]
Creating a new SqlSession
Registering transaction synchronization for SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1fecaacc]
JDBC Connection [com.mysql.cj.jdbc.ConnectionImpl@ff2f031] will be managed by Spring
==>  Preparing: INSERT INTO his_check_result ( item_id, check_item_id, check_item_name, price, patient_id, patient_name, result_status, reg_id, create_time, create_by ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ? ) 
==> Parameters: ITEM1363797224076738560(String), 2(Integer), 血常规(String), 5.00(BigDecimal), HZ1363797038256488448(String), CC(String), 0(String), GH1363797039326035968(String), 2021-02-25 19:00:19.98(Timestamp), 扁鹊(String)
Releasing transactional SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1fecaacc]
Transaction synchronization deregistering SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1fecaacc]
Transaction synchronization closing SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@1fecaacc]


JAVA 全系列/第二十一阶段:分布式医疗云平台/检查管理前后端开发(旧) 37472楼
JAVA 全系列/第八阶段:Linux入门到实战/Maven 37473楼

2c5ad9aa38070cc7f732e16d327904a.png

老师这个报错是怎么回事

Python 全系列/第二阶段:Python 深入与提高/文件处理 37474楼
JAVA 全系列/第九阶段:Spring Boot实战/Spring Boot 37475楼

class Employee:
    __init_flag=True

    def __init__(self,id,name,salary):
        self.id = id
        self.name=name
        self.__salary=salary

    def __add__(self, other):    #+运算符重载
        if isinstance(other,Employee):
            return self.__salary+other.__salary   #两个对象相加时,返回薪水和
        else:
            print('两个雇员不属于一个公司,不能相加')

    @property
    def salary(self):
        return self.__salary

    @salary.setter
    def salary(self,salary):
        if (1000<salary<50000):   #限制薪水范围
            self.__salary=salary
        else:
            print('薪水录入错误,请重新录入')

    def input(self):
        d=1000
        if self.id=='':  #当不输入id时
            if Employee.__init_flag:
                self.id=1000   #给第一个员工id为1000
                Employee.__init_flag=False
                return self.id
            else:
                d+=1    #给第二个员工及之后的员工id加1
                self.id=d
                return self.id
        else:            #当输入id时
            return self.id

e3=Employee('','小李',5500)
e4=Employee('','小刘',38000)
print(e3.input())
print(e4.input())    #当不输入id时,雇员id依次递增

e1=Employee(1007,'小王',4500)
e2=Employee(1008,'小张',6000)
print(e1+e2)     #两个雇员相加时,返回薪水和

e5=Employee(1009,'小蒙',-900)
print(e5.salary)

运算结果e5.salary是负值:-900,为什么不是判断“薪水录入错误,请重新录入”,我看到提问区有个小伙伴的问题跟我一样,但是老师的回答没看懂,麻烦老师解答,谢谢


Python 全系列/第一阶段:Python入门/面向对象 37476楼
JAVA 全系列/第一阶段:JAVA 快速入门/飞机大战小项目训练 37477楼
WEB前端全系列/第十阶段:Nodejs编程模块/Node.js基础 37479楼

"""开发画图软件的菜单"""

from tkinter.colorchooser import *
from tkinter import *

# 窗口的宽度和高度
win_width = 900
win_height = 450


class Application(Frame):

    def __init__(self, master=None):
        super().__init__(master)
        self.master = master
        self.bgcolor = "#000000"
        self.x = 0
        self.y = 0
        self.fgcolor = "#ff0000"
        self.lastDraw = 0  # 表示最后绘制的图形的id
        self.startDrawFlag = False
        self.pack()
        self.createWidget()

    def createWidget(self):
        # 创建绘图区
        self.drawpad = Canvas(root, width=win_width, height=win_height * 0.9, bg=self.bgcolor)
        self.drawpad.pack()

        # 创建按钮
        btn_start = Button(root, text="开始", name="start")
        btn_start.pack(side="left", padx="10")
        btn_pen = Button(root, text="笔画", name="pen")
        btn_pen.pack(side="left", padx="10")
        btn_rect = Button(root, text="矩形", name="rect")
        btn_rect.pack(side="left", padx="10")
        btn_clear = Button(root, text="清屏", name="clear")
        btn_clear.pack(side="left", padx="10")
        btn_erasor = Button(root, text="橡皮擦", name="erasor")
        btn_erasor.pack(side="left", padx="10")
        btn_line = Button(root, text="直线", name="line")
        btn_line.pack(side="left", padx="10")
        btn_lineArrow = Button(root, text="箭头直线", name="lineArrow")
        btn_lineArrow.pack(side="left", padx="10")
        btn_color = Button(root, text="颜色", name="color")
        btn_color.pack(side="left", padx="10")

        # 事件处理
        btn_pen.bind_class("<Button>", "<1>", self.eventManager)
        self.drawpad.bind("<ButtonRelease-1>", self.stopDraw)

        # 增加颜色切换快捷键处理
        root.bind("<KeyPress-r>", self.kuaijiejian)
        root.bind("<KeyPress-g>", self.kuaijiejian)
        root.bind("<KeyPress-y>", self.kuaijiejian)

    def eventManager(self, event):
        name = event.widget.winfo_name()
        print(name)
        if name == "line":
            self.drawpad.bind("<B1-Motion>", self.myline)
        elif name == "lineArrow":
            self.drawpad.bind("<B1-Motion>", self.mylineArrow)

        elif name == "rect":
            self.drawpad.bind("<B1-Motion>", self.myRect)

        elif name == "pen":
            self.drawpad.bind("<B1-Motion>", self.myPen)

        elif name == "erasor":
            self.drawpad.bind("<B1-Motion>", self.myErasor)

        elif name == "clear":
            self.drawpad.delete("all")

        elif name == "color":
            c = askcolor(color=self.fgcolor, title="选择笔画颜色")

            self.fgcolor = c[1]


    def stopDraw(self):
        self.startDrawFlag = False
        self.lastDraw = 0

    def startDraw(self, event):
        self.drawpad.delete(self.lastDraw)

        if not self.startDrawFlag:
            self.startDrawFlag = True
            self.x = event.x
            self.y = event.y

    def myline(self, event):
        self.startDraw(event)
        self.lastDraw = self.drawpad.create_line(self.x, self.y, event.x, event.y, fill=self.fgcolor)

    def mylineArrow(self, event):
        self.startDraw(event)
        self.lastDraw = self.drawpad.create_line(self.x, self.y, event.x, event.y, arrow=LAST, fill=self.fgcolor)

    def myRect(self, event):
        self.startDraw(event)
        self.lastDraw = self.drawpad.create_rectangle(self.x, self.y, event.x, event.y, outline=self.fgcolor)

    def myPen(self, event):
        self.startDraw(event)
        self.drawpad.create_line(self.x, self.y, event.x, event.y, fill=self.fgcolor)
        self.x = event.x
        self.y = event.y

    def myErasor(self, event):
        self.startDraw(event)
        self.drawpad.create_rectangle(event.x-4, event.y-4, event.x+4, event.y+4, fill=self.bgcolor)
        self.x = event.x
        self.y = event.y

    def kuaijiejian(self, event):
        if event.char == "r":
            self.fgcolor = "#ff0000"
        elif event.char == "g":
            self.fgcolor = "#00ff00"
        elif event.char == "y":
            self.fgcolor = "#ffff00"


if __name__ == '__main__':
    root = Tk()
    root.geometry(str(win_width) + "x" + str(win_height) + "+200+300")
    root.title("画图软件项目")
    app = Application(master=root)
    root.mainloop()

老师,这代码总是有些问题,代码照着敲的,总是报这样的错误

也不知道哪里说啥,startDraw(),一个位置参数被给于了两个!屏幕截图 2021-03-22 221317.png

Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 37480楼
JAVA 全系列/第十五阶段:Spring Session会话管理/Spring Session 37481楼
Python 全系列/第一阶段:Python入门/Python入门(动画版) 37482楼
JAVA 全系列/第七阶段:生产环境部署与协同开发/Docker 37483楼

image.png

一直报这个错,老师帮忙看看

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.bjsxt</groupId>
    <artifactId>plugs</artifactId>
    <version>1.0-SNAPSHOT</version>
    <!--1.1.2在pom.xml 文件中配置局部的编译插件-->
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <!--tomcat插件-->
            <plugin>
            <groupId>org.apache.tomcat.maven</groupId>
            <artifactId>tomcat7-maven-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <!-- 配置 Tomcat 监听端口 -->
                <port>8080</port>
                <!-- 配置项目的访问路径(Application Context) -->
                <path>/</path>
            </configuration>
        </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/java</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <includes>
                    <include>**/*.xml</include>
                </includes>
            </resource>
        </resources>
    </build>

</project>


JAVA 全系列/第八阶段:Linux入门到实战/Maven 37484楼
JAVA 全系列/第十一阶段:分布式RPC调用和分布式文件存储/Dubbo 37485楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

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