def __init__(self, parent, title, image, message, life, height, ipad, *args):
ttk.Frame.__init__(self, parent, height=height, style="Popup.TFrame", *args)
self.parent = parent
self._title = title
self._image = image
self._life = life
self._message = message
self._ipad = ipad
self.grid_propagate(False)
self.rowconfigure(1, weight=1)
self.columnconfigure(1, weight=1)
image = ttk.Label(self, image=self._image, style="Image.Popup.TLabel")
image.grid(row=0, column=0, rowspan=2, sticky="nesw", padx=self._ipad, pady=self._ipad)
title_frame = ttk.Frame(self)
title_frame.grid(row=0, column=1, sticky="we", padx=self._ipad, pady=self._ipad)
label = ttk.Label(title_frame, text=self._title, style="Title.Popup.TLabel")
label.pack(side="left", fill="both", expand=True)
close = ttk.Button(title_frame, text="X", width=3, command=self.remove, style="Close.Popup.TButton")
close.pack(side="right")
message = ttk.Label(self, text=self._message, style="Message.Popup.TLabel")
message.grid(row=1, column=1, sticky="nw", padx=self._ipad, pady=self._ipad)
if self._life > 0:
self.after(self._life, self.remove)
评论列表
文章目录