推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
oldbird
V2EX  ›  Python

Python 脚本运行时如何弹出 yesno 对话框

  •  
  •   oldbird · Feb 27, 2021 · 3166 views
    This topic created in 1929 days ago, the information mentioned may be changed or developed.

    tkinter.messagebox.askyesno 可以,但同时会弹出一个单独的窗体,如何只弹出 yesno 对话框?

    4 replies    2021-02-28 08:24:22 +08:00
    ClericPy
        1
    ClericPy  
       Feb 27, 2021
    如果不介意第三方, 我之前用的 pymsgbox
    介意的话, 忘记了...
    delectate
        2
    delectate  
       Feb 27, 2021
    #import ctypes;

    #dll = ctypes.WinDLL('user32.dll');

    #dll.MessageBox();
    #need install pywin32
    import win32api, win32gui
    import win32con, winerror,win32event,pywintypes
    import sys, os,time
    win32api.MessageBox(0,'hello', 'messagebox',win32con.MB_OK)

    #import win32api,win32con
    usr_select = win32api.MessageBox(0, "这是一个测试消息", "消息框标题",win32con.MB_YESNO)
    if usr_select ==6:
    print("click yes")
    zictos
        3
    zictos  
       Feb 27, 2021
    import tkinter
    import tkinter.messagebox as messagebox

    root = tkinter.Tk()
    root.withdraw()
    print(messagebox.askokcancel("标题","内容"))
    oldbird
        4
    oldbird  
    OP
       Feb 28, 2021
    @zictos @ClericPy @delectate 谢谢各位。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3173 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 11:47 · PVG 19:47 · LAX 04:47 · JFK 07:47
    ♥ Do have faith in what you're doing.