'Is there a way to make the toaster notification in windows 10 pop-up when you convert the python file to an executable?

I made a code such that it prompts a popup window and when you click the only button of the window a toaster notification would appear. However, if I convert the code from python to executable, only the popup window would appear. How can I fix this problem such that both the popup window and toaster notification would appear when I run the executable?

Here is the code that I converted to executable:

import mpmath as mp
from win10toast import ToastNotifier
from mpmath import *
import tkinter as tk

# Pop-up Window #
LARGE_FONT = ("Arial", 12)
NORM_FONT = ("Arial", 10)
SMALL_FONT = ("Arial", 8)


def popupmsg(msg):
    popup = tk.Tk()
    popup.wm_title("Notification")
    label = tk.Label(popup, text=msg)
    label.pack(side="top", fill="x", pady=50, padx=50)
    B1 = tk.Button(popup, text="Okay", command=popup.destroy)
    B1.pack()
    popup.mainloop()

def windowspopup():
    toast = ToastNotifier()
    toast.show_toast('Message A', 'Message B')

# Calculatory Algorithm and output / Execution Time Delayer #
mp.dps = 100

sum = mpf(0)
for i in range(1, 99):
    f = mpf(1) / mpf(mpf(i) ** mpf(2))
    sum = mpf(sum) + mpf(f)
    if i == 98:
        f1 = len(str(sum))
        f2 = mpf((mpf(6) * mpf(sum)) ** mpf(0.5))
        # print(f1)
        # print(f2)
        popupmsg('Hello, click my ok button and an important message would appear ')
        windowspopup()

Thank you in advance!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source