|
楼主 |
发表于 2024-1-29 22:16:54
|
显示全部楼层
大佬能帮我看看这个吗?
我把main函数注释掉了按照大佬这个方法能成功
但是不注释的话就会报错
- Exception in thread T2:
- Traceback (most recent call last):
- File "C:\Users\Qin_\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 1052, in _bootstrap_inner
- self.run()
- File "C:\Users\Qin_\AppData\Local\Programs\Python\Python312\Lib\threading.py", line 989, in run
- self._target(*self._args, **self._kwargs)
- File "c:\Users\Qin_\Desktop\Program\在线聊天室\Version 4.0(春节特供版)\client.py", line 77, in fasong
- re_data = send_entry.get("1.0", END)[:-1]
- ^^^^^^^^^^^^^^
- AttributeError: 'NoneType' object has no attribute 'get'
- Traceback (most recent call last):
- File "c:\Users\Qin_\Desktop\Program\在线聊天室\Version 4.0(春节特供版)\client.py", line 603, in <module>
- loginSendToServer(loginfuc1, loginfuc2)
- File "c:\Users\Qin_\Desktop\Program\在线聊天室\Version 4.0(春节特供版)\client.py", line 56, in loginSendToServer
- main()
- File "c:\Users\Qin_\Desktop\Program\在线聊天室\Version 4.0(春节特供版)\client.py", line 497, in main
- image_button = Button(centerFrame, image=photo, bootstyle="info-outline", command=sendImage)
- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- File "C:\Users\Qin_\AppData\Local\Programs\Python\Python312\Lib\site-packages\ttkbootstrap\style.py", line 4941, in __init__
- func(self, *args, **kwargs)
- File "C:\Users\Qin_\AppData\Local\Programs\Python\Python312\Lib\tkinter\ttk.py", line 582, in __init__
- Widget.__init__(self, master, "ttk::button", kw)
- File "C:\Users\Qin_\AppData\Local\Programs\Python\Python312\Lib\tkinter\ttk.py", line 527, in __init__
- tkinter.Widget.__init__(self, master, widgetname, kw=kw)
- File "C:\Users\Qin_\AppData\Local\Programs\Python\Python312\Lib\tkinter\__init__.py", line 2629, in __init__
- self.tk.call(
- _tkinter.TclError: image "pyimage9" doesn't exist
复制代码
第一个报错不用管,没事
但是后面那个报错 我图片什么在之前都能够正常用 现在就报错了
用绝对路径也不行
- """------------------------------发送框-------------------------------------------"""
- send_entry = Text(centerFrame, width=55, height=4, font=("微软雅黑", 13)) # 发送区域
- send_entry.place(x=10, y=460)
- send_button = Button(centerFrame, text="\n发 送\n", command=fasong_Init) # 发送按钮
- send_button.place(x=585, y=460)
- phtotICON = Image.open(r"C:\Users\Qin_\Desktop\Program\在线聊天室\Version 4.0(春节特供版)\log\image1.png")
- photowidth, photoheight = phtotICON.size
- photonew_width = int(photowidth * 0.06) # 调整宽度为原始宽度的50%
- photonew_height = int(photoheight * 0.06) # 调整高度为原始高度的50%
- photoimage = phtotICON.resize((photonew_width, photonew_height)) # 调整图像大小
- photo = ImageTk.PhotoImage(photoimage)
- image_button = Button(centerFrame, image=photo, bootstyle="info-outline", command=sendImage)
- image_button.place(x=575, y=530)
- phtotICON1 = Image.open(r"./log\设置_setting-three.png")
- photowidth1, photoheight1 = phtotICON1.size
- photonew_width1 = int(photowidth1 * 0.06) # 调整宽度为原始宽度的50%
- photonew_height1 = int(photoheight1 * 0.06) # 调整高度为原始高度的50%
- photoimage1 = phtotICON1.resize((photonew_width1, photonew_height1)) # 调整图像大小
- photo1 = ImageTk.PhotoImage(photoimage1)
- settingButton = Button(centerFrame, image=photo1, bootstyle="info-outline", command=SystemSetting)
- settingButton.place(x=613, y=530)
- send_entry.bind("<Return>", fasong_Init)
- send_entry.bind("<Control-Return>", insert_newline)
- """------------------------------发送框-------------------------------------------"""
复制代码 |
|