close
Python Forum
[WxPython] [SOLVED] Simple dialog without app?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[WxPython] [SOLVED] Simple dialog without app?
#1
Question 
Hello,

Out of curiosity, is it possible to show a simple messagebox without an app instance?

app = wx.App()
wx.MessageBox("text", "title")
Thank you.
Reply
#2
No

import wx

wx.MessageBox("text", "title")
Output:
Traceback (most recent call last): File "/tmp/tmp.py", line 5, in <module> wx.MessageBox("text", "title") wx._core.PyNoAppError: The wx.App object must be created first!
Reply
#3
tkinter can do it

import tkinter as tk
from tkinter import messagebox

def show_message():
    messagebox.showinfo("Greetings", "Hello, World!")

root = tk.Tk()
root.withdraw()  # hide the root window
show_message()
Reply
#4
Thanks, but I use wxPython as a GUI.

So I guess the app instance is required.
Reply
#5
In every GUI framework you need something that starts the event loop.
In Tkinter that's the main Tk instance, in wxPython it's wx.App
Reply
#6
Thanks for the info.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Smile [Tkinter] Trying to make Fond Dialog box TheTiger 11 4,146 Oct-16-2024, 01:56 AM
Last Post: menator01
  How a QMainWindow can open a dialog? panoss 4 6,893 Feb-03-2022, 04:33 PM
Last Post: panoss
  [Tkinter] question for a tkinter dialog box RobertAlvarez424 2 3,696 Aug-25-2021, 03:08 PM
Last Post: RobertAlvarez424
  [Tkinter] cancelling open dialog gives empty string rwahdan 2 6,053 Jul-17-2021, 09:17 PM
Last Post: steve_shambles
  [WxPython] Return code when closing the dialog ioprst 1 4,571 Aug-13-2019, 11:47 AM
Last Post: jefsummers
  PyQT5 : Unable to Create Another Dialog While One is Open iMuny 3 6,271 Jul-17-2019, 11:40 AM
Last Post: iMuny
  [WxPython] Any dialog that allow user to select file OR folder? buran 3 6,695 Apr-03-2019, 06:33 PM
Last Post: Yoriz
  [WxPython] how to run the dialog from another py file royer14 0 3,688 Jul-02-2018, 05:33 AM
Last Post: royer14
  FileBrowser dialog reverendfuzzy 5 7,039 May-06-2018, 01:56 PM
Last Post: reverendfuzzy
  I'm trying to create a simple yes/no dialog box RedSkeleton007 15 28,323 Apr-25-2018, 05:10 PM
Last Post: nilamo

Forum Jump:
Image

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020