会员可以在此提问,百战程序员老师有问必答
对大家有帮助的问答会被标记为“推荐”
看完课程过来浏览一下别人提的问题,会帮你学得更全面
截止目前,同学们一共提了 132441个问题
JAVA 全系列/(旧的隐藏)第十五阶段:百战商城项目(Spring Cloud最新架构)/百战商城项目 35866楼

from tkinter import *
from tkinter import messagebox
import random

win_width=450
win_height=300
class Application(Frame):
    def __init__(self,master):
        super().__init__(master)
        self.master = master
        self.pack()
        # label组建:小姐姐真漂亮,我喜欢你,图片
        self.label01 = Label(root, text="小姐姐真漂亮,我喜欢你\n做我女朋友好吗?"
                             , font=("KaiTi", 17), width=27, height=2, fg="red")
        self.label01.place(x=0, y=0)
        global photo
        photo = PhotoImage(file="e:/python图片/AKAKA.gif")
        self.label02 = Label(root, image=photo)
        self.label02.place(x=200, y=60)

        # 设置按钮好哒、不愿意
        self.but01 = Button(root, text="好哒", font=("KaiTi", 28), command=self.haoda, activebackground="blue")
        self.but01.place(x=60,y=70)
        self.but02 = Button(root,text="不愿意", font=("KaiTi", 15))
        self.but02.place(x=60,y=170)

        self.but02.bind("<Enter>",self.buyuanyi)

    def buyuanyi(self, event):
        x1 = random.randrange(int(win_width)-50)
        y1 = random.randrange(int(win_height)-50)
        print(x1, y1)
        self.but02.place(x=x1, y=y1)

    def haoda(self):
        messagebox.showinfo("宝贝", "属于我们的甜甜的恋爱开始啦")
        root.destroy()


if __name__ == '__main__':
    root = Tk()
    root.title("I LOVE U")
    root.geometry(str(win_width)+"x"+str(win_height)+"+700+400")
    app = Application(root)
    root.mainloop()

老师,为啥这些地方是root,不能是self,我用了self,就显示不出来了?417236ae20f6b9145b984759fc5ab06.png

Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 35867楼
Python 全系列/第二阶段:Python 深入与提高/GUI编程(隐藏) 35869楼
Python 全系列/第三阶段:Python 网络与并发编程/并发编程 35870楼
JAVA 全系列/第四阶段:网页编程和设计/HTML5(旧) 35872楼

java.lang.IllegalStateException: Failed to execute ApplicationRunner

at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:773) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]

at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:760) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:318) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1213) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]

at org.springframework.boot.SpringApplication.run(SpringApplication.java:1202) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]

at com.wh.item.CommomItemApplication.main(CommomItemApplication.java:21) [classes/:na]

Caused by: java.lang.IllegalStateException: There is no normal TM.

at com.codingapi.txlcn.tc.txmsg.TMSearcher.search(TMSearcher.java:86) ~[txlcn-tc-5.0.2.RELEASE.jar:5.0.2.RELEASE]

at com.codingapi.txlcn.tc.txmsg.AutoTMClusterEngine.prepareToResearchTMCluster(AutoTMClusterEngine.java:83) ~[txlcn-tc-5.0.2.RELEASE.jar:5.0.2.RELEASE]

at com.codingapi.txlcn.tc.txmsg.AutoTMClusterEngine.onConnectFail(AutoTMClusterEngine.java:69) ~[txlcn-tc-5.0.2.RELEASE.jar:5.0.2.RELEASE]

at com.codingapi.txlcn.tc.txmsg.TCSideRpcInitCallBack.lambda$connectFail$3(TCSideRpcInitCallBack.java:107) ~[txlcn-tc-5.0.2.RELEASE.jar:5.0.2.RELEASE]

at java.util.ArrayList.forEach(ArrayList.java:1257) ~[na:1.8.0_191]

at com.codingapi.txlcn.tc.txmsg.TCSideRpcInitCallBack.connectFail(TCSideRpcInitCallBack.java:107) ~[txlcn-tc-5.0.2.RELEASE.jar:5.0.2.RELEASE]

at com.codingapi.txlcn.txmsg.netty.impl.NettyRpcClientInitializer.connect(NettyRpcClientInitializer.java:125) ~[txlcn-txmsg-netty-5.0.2.RELEASE.jar:5.0.2.RELEASE]

at com.codingapi.txlcn.txmsg.netty.impl.NettyRpcClientInitializer.init(NettyRpcClientInitializer.java:85) ~[txlcn-txmsg-netty-5.0.2.RELEASE.jar:5.0.2.RELEASE]

at com.codingapi.txlcn.tc.txmsg.TCRpcServer.init(TCRpcServer.java:58) ~[txlcn-tc-5.0.2.RELEASE.jar:5.0.2.RELEASE]

at com.codingapi.txlcn.common.runner.TxLcnApplicationRunner.run(TxLcnApplicationRunner.java:54) ~[txlcn-common-5.0.2.RELEASE.jar:5.0.2.RELEASE]

at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:770) [spring-boot-2.1.6.RELEASE.jar:2.1.6.RELEASE]

... 5 common frames omitted


JAVA 全系列/(旧的隐藏)第十五阶段:百战商城项目(Spring Cloud最新架构)/百战商城项目 35874楼
JAVA 全系列/(旧的隐藏)第八阶段:电商高级项目_架构/编码/电商ego-基于solr_实现商品数据检索 35876楼
Python 全系列/第十五阶段:Python 爬虫开发/分布式爬虫 35879楼
JAVA 全系列/第三阶段:数据库编程/SQL 语言 35880楼

课程分类

百战程序员微信公众号

百战程序员微信小程序

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