当前位置:网站首页>使用class toplevel的messagebox时,窗口弹出问题。
使用class toplevel的messagebox时,窗口弹出问题。
2022-06-28 04:29:00 【sunshinei928】
在一个小项目中遇到主窗口和toplevel窗口都使用class类时,toplevel窗口弹出的messagebox会主动跳转到主窗口中,同时toplevel窗口会自动在主窗口后面。
查阅了网上资料,主要方法都是在messagebox增加parent参数,如下代码。
from tkinter.messagebox import *
root = Tk()
texto = Toplevel(root)
showinfo("title", "message",parent=texto)但项目中使用的是class,toplevel没有明确的parent,在csdn中是有网友使用parent=self._root,但测试后并不对。
from tkinter import *
from tkinter.ttk import *
from tkinter.messagebox import *
import os
currentpath=os.path.dirname(__file__)
class AcurateQueryWindow(Toplevel):
showwarning('warning','input four parameters!')
后再stackoverflow上求助,给出的答案是parent=self。测试通过,弹出的messagebox位于toplevel窗口前。
showwarning('warning','input four parameters!',parent=self)
边栏推荐
- filinCdc 的sql,多表的时候总报这个错,请问下该怎么解决呀
- 判断对象中是否存在某一个属性
- 代码理解:IMPROVING CONVOLUTIONAL MODELS FOR HANDWRITTEN TEXT RECOGNITION
- Where does the storm go? Whose pot is the weather forecast wrong?
- Notepad++ -- common plug-ins
- Sword finger offer 47 Maximum gift value (DP)
- Flexible IP network test tool -- x-launch
- Source code of live video system, countdown display, countdown of commodity spike
- ?位置怎么写才能输出true
- The second round of free public classes of the red team is coming ~ 8:00 tomorrow night!
猜你喜欢

学习太极创客 — MQTT 第二章(四)ESP8266 保留消息应用

如何从零设计一款牛逼的高并发架构(建议收藏)

100+数据科学面试问题和答案总结 - 机器学习和深度学习

S32ds jump to defaultisr

cgo+gSoap+onvif学习总结:8、arm平台交叉编译运行及常见问题总结

CUPTI error: CUPTI could not be loaded or symbol could not be found.

Annual comprehensive analysis of China's audio market in 2022

2022年全国最新消防设施操作员(初级消防设施操作员)模拟题及答案

2022-06-27:给出一个长度为n的01串,现在请你找到两个区间, 使得这两个区间中,1的个数相等,0的个数也相等, 这两个区间可以相交,但是不可以完全重叠,即两个区间的左右端点不可以完全一样。

Ppt production tips
随机推荐
【Proteus仿真】定时器1外部计数中断
Distributed transaction - Final consistency scheme based on message compensation (local message table, message queue)
UI automation test framework construction - write an app automation
如何从零设计一款牛逼的高并发架构(建议收藏)
创新之源 理解通透 二
Is it true that qiniu business school gives away securities accounts? Is it safe to open an account
Congratulations to myself, official account has more than ten thousand fans
Feign通过自定义注解实现路径的转义
C语言全局变量(c文件和h文件中的全局变量、静态全局变量)使用注意事项
Meta universe standard forum established
cgo+gSoap+onvif学习总结:8、arm平台交叉编译运行及常见问题总结
How do I get the STW (pause) time of a GC (garbage collector)?
Severe tire damage: the first rock band in the world to broadcast live on the Internet
Flinkcdc collects Oracle, and the Oracle database is CDB's
Moonbeam integrates coin98, giving users more choices on the multi chain road
Why is the frame rate calculated by opencv wrong?
Google Earth Engine(GEE)——全球洪水数据库 v1 (2000-2018年)
互联网的发展促进了无界零售、数字零售、即时零售等一系列新模式的出现
Severe tire damage: the first rock band in the world to broadcast live on the Internet
How can we speed up the chunksplitter when CDC extracts MySQL data in full?