What's the simplest cross-platform way to pop up graphical dialogs in Python?

后端 未结 10 2197
一生所求
一生所求 2020-12-13 04:15

I want the simplest possible way to pop up simple dialogs in Python scripts. Ideally, the solution would:

  • Work on Windows, OS X, Gnome, KDE
  • Look like
10条回答
  •  抹茶落季
    2020-12-13 04:42

    To extend on endolith's tkMessageBox answer with the ugly empty window in the background...

    The code below pops up the box without the background window.

    import Tkinter, tkMessageBox
    root = Tkinter.Tk()
    root.withdraw()
    tkMessageBox.showinfo("my dialog title", "my dialog message")
    

    This is lifted directly from a useful comment I found at the bottom of this article. Thanks to Jason (the commenter) and effbot.org.

提交回复
热议问题