V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
? 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 · 2021-02-27 15:59:34 +08:00 · 2266 次点击
    这是一个创建于 1170 天前的主题,其中的信息可能已经有所发展或是发生改变。

    腾讯云最新优惠活动来了:云产品限时1折,云服务器低至88元/年 ,点击这里立即抢购:9i0i.cn/qcloud,更有2860元代金券免费领取,付款直接抵现金用,点击这里立即领取:9i0i.cn/qcloudquan

    (福利推荐:你还在原价购买阿里云服务器?现在阿里云0.8折限时抢购活动来啦!4核8G企业云服务器仅2998元/3年,立即抢购>>>:9i0i.cn/aliyun

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

    4 条回复  ?  2021-02-28 08:24:22 +08:00
    ClericPy
        1
    ClericPy  
       2021-02-27 16:20:27 +08:00
    如果不介意第三方, 我之前用的 pymsgbox
    介意的话, 忘记了...
    delectate
        2
    delectate  
       2021-02-27 18:25:23 +08:00
    #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  
       2021-02-27 20:10:06 +08:00
    import tkinter
    import tkinter.messagebox as messagebox

    root = tkinter.Tk()
    root.withdraw()
    print(messagebox.askokcancel("标题","内容"))
    oldbird
        4
    oldbird  
    OP
       2021-02-28 08:24:22 +08:00
    @zictos @ClericPy @delectate 谢谢各位。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3081 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 14:46 · PVG 22:46 · LAX 07:46 · JFK 10:46
    Developed with CodeLauncher
    ? Do have faith in what you're doing.


    http://www.vxiaotou.com