{"id":221248,"date":"2020-11-27T02:57:23","date_gmt":"2020-11-26T18:57:23","guid":{"rendered":"http:\/\/4563.org\/?p=221248"},"modified":"2020-11-27T02:57:23","modified_gmt":"2020-11-26T18:57:23","slug":"tkinter-%e4%bd%bf%e7%94%a8-messagebox-%e7%9a%84%e5%87%bd%e6%95%b0%e6%89%a7%e8%a1%8c%e9%a1%ba%e5%ba%8f%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=221248","title":{"rendered":"tkinter \u4f7f\u7528 messagebox \u7684\u51fd\u6570\u6267\u884c\u987a\u5e8f\u95ee\u9898"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  tkinter \u4f7f\u7528 messagebox \u7684\u51fd\u6570\u6267\u884c\u987a\u5e8f\u95ee\u9898               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : MasterCai <\/span>  <span><i><\/i> 3<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u4e00\u4e2a\u7a97\u4f53\u5e94\u7528\uff0c\u6709\u4e00\u4e2a button <code>btn = tk.Button(frm_r, text='hit', command=hit).pack()<\/code> hit \u51fd\u6570\u4e3a\uff1a<\/p>\n<pre><code>def hit():     print('h')     main_board[4][4].create_image(3, 3, anchor='nw', image=led['yellow']) # \u5728\u7a97\u4f53\u7684\u67d0\u4e2a canvas \u4e0a\u52a0\u8f7d\u56fe\u50cf     tk.messagebox.showinfo(title='ff', message='mm')     print('hhh') <\/code><\/pre>\n<p>\u5f53\u6211\u5355\u51fb btn \u65f6\uff0c\u63a7\u5236\u53f0\u5148\u6253\u5370\u51fa\u4e86&#8217;h&#8217;\uff0c\u7136\u540e\u5e76\u6ca1\u6709\u6267\u884c <code>main_board[4][4].create_image(3, 3, anchor='nw', image=led['yellow'])<\/code> \u8fd9\u4e00\u53e5\u4ee3\u7801\uff0c\u800c\u662f\u76f4\u63a5\u8df3\u51fa messagebox\uff0c\u540c\u65f6 btn \u4fdd\u6301\u7740\u88ab\u70b9\u51fb\u7684\u72b6\u6001\uff0c\u5f53\u6211\u5173\u6389 messagebox \u4e4b\u540e\uff0ccreate_image \u624d\u6267\u884c\uff0c\u7136\u540e\u63a7\u5236\u53f0\u6253\u5370\u51fa&#8217;hhh&#8217; \u6211\u7684\u95ee\u9898\u662f\u60f3\u8ba9\u8fd9\u4e2a\u4ee3\u7801\u6309\u987a\u5e8f\u6267\u884c\uff08\u5148\u6267\u884c create_image \u518d\u6267\u884c messagebox \uff09\uff0c\u60f3\u8bf7\u6559\u4e00\u4e0b\u5e94\u8be5\u600e\u4e48\u8c03\u6574\uff0c\u6216\u8005\u662f\u6211\u54ea\u91cc\u7406\u89e3\u6709\u9519\u8bef\uff1f Google \u65e0\u679c\uff0c\u6c42\u52a9\u5404\u4f4d V \u7ad9\u5927\u795e\uff08 python \u7248\u672c 3.7 \u548c 3.8 \u90fd\u5df2\u7ecf\u5c1d\u8bd5\u8fc7\u4e86\uff0c\u7ed3\u679c\u4e00\u6837\uff09<\/p>\n<\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>4<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4463013\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : mcoo1997 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5b9e\u9645\u4e0a\u5df2\u7ecf\u6267\u884c\u4e86 \u8fd8\u6ca1\u6765\u5f97\u53ca\u5237\u65b0\u754c\u9762\u5c31\u6267\u884c\u4e0b\u4e00\u4e2a\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4463014\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : mcoo1997 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0d\u592a\u786e\u5b9a time.sleep \u662f\u5426\u6709\u7528 \u4f60\u53ef\u4ee5\u8bd5\u8bd5                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4463015\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : MasterCai <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @mcoo1997 \u611f\u8c22\u63d0\u9192\uff0c\u6211\u53c8\u67e5\u4e86\u4e00\u4e0b\u8d44\u6599\uff0c\u8c03\u7528\u4e86 canvas.update() \u89e3\u51b3\u4e86\u8fd9\u4e2a\u95ee\u9898\u3002\u4f46\u662f\u8fd8\u5b58\u5728\u4e00\u4e2a\u95ee\u9898\u5c31\u662f\u5982\u679c\u70b9\u51fb\u592a\u5feb\u597d\u50cf update \u4e5f\u6765\u4e0d\u53ca\u6267\u884c\uff0c\u4f1a\u5b58\u5728\u6982\u7387\u6027\u7684 update \u7684\u60c5\u51b5\u3002<br \/>\u53e6\u5916\u8fd8\u60f3\u8bf7\u6559\u4e00\u4e2a\u95ee\u9898\uff0c\u5982\u679c\u6211\u6709\u591a\u4e2a button\uff0ccommand \u7ed1\u5b9a\u4e86\u540c\u4e00\u4e2a\u51fd\u6570 func \u7684\u8bdd\uff0c\u6211\u8981\u600e\u4e48\u624d\u80fd\u5728 func \u4e2d\u533a\u522b\u662f\u54ea\u4e2a button \u70b9\u51fb\u800c\u89e6\u53d1\u7684\u8fd9\u4e2a func \u5462\uff1f                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4463016\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : mcoo1997 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @MasterCai \u6bcf\u4e2a\u6309\u94ae\u5206\u5f00\u5199\u4e2a\u51fd\u6570\u53bb\u8c03\u7528\u4f60\u539f\u6765\u7684\u51fd\u6570\u554a tk \u5728\u7ebf\u7a0b\u65b9\u9762\u7684\u5751\u5f88\u591a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>tkinter \u4f7f\u7528 messag&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/221248"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=221248"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/221248\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=221248"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=221248"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=221248"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}