{"id":2119,"date":"2025-10-29T01:01:55","date_gmt":"2025-10-28T17:01:55","guid":{"rendered":"https:\/\/womeifei.cn\/?p=2119"},"modified":"2025-10-29T21:45:46","modified_gmt":"2025-10-29T13:45:46","slug":"python-warmtips-code","status":"publish","type":"post","link":"https:\/\/womeifei.cn\/index.php\/2025\/10\/29\/python-warmtips-code\/","title":{"rendered":"Python Warmtips Code"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><strong>Python\u4ee3\u7801<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import tkinter as tk\nimport random\nimport threading\nimport time\n\ndef show_warm_tip():\n    window = tk.Tk()\n\n    screen_width = window.winfo_screenwidth()\n    screen_height = window.winfo_screenheight()\n\n    window_width = 250\n    window_height = 60\n\n    x=random.randrange(0,screen_width-window_width)\n    y=random.randrange(0,screen_height-window_height)\n\n    window.title(\"\u6e29\u99a8\u63d0\u793a\")\n\n    window.geometry(f\"{window_width}x{window_height}+{x}+{y}\")\n\n    tips = &#91;\n        '\u591a\u559d\u6c34\u54e6~', '\u4fdd\u6301\u5fae\u7b11\u5440', '\u6bcf\u5929\u90fd\u8981\u5143\u6c14\u6ee1\u6ee1',\n        '\u8bb0\u5f97\u5403\u6c34\u679c', '\u4fdd\u6301\u597d\u5fc3\u60c5', '\u597d\u597d\u7231\u81ea\u5df1', '\u6211\u60f3\u4f60\u4e86',\n        '\u68a6\u60f3\u6210\u771f', '\u671f\u5f85\u4e0b\u4e00\u6b21\u89c1\u9762', '\u91d1\u699c\u9898\u540d',\n        '\u987a\u987a\u5229\u5229', '\u65e9\u70b9\u4f11\u606f', '\u613f\u6240\u6709\u70e6\u607c\u90fd\u6d88\u5931',\n        '\u522b\u71ac\u591c', '\u4eca\u5929\u8fc7\u5f97\u5f00\u5fc3\u561b', '\u5929\u51b7\u4e86\uff0c\u591a\u7a7f\u8863\u670d'\n    ]\n    tip = random.choice(tips)\n\n    bg_colors = &#91;\n        'lightpink', 'skyblue', 'lightgreen', 'lavender',\n        'lightyellow', 'plum', 'coral', 'bisque', 'aquamarine',\n        'mistyrose', 'honeydew', 'lavenderblush', 'oldlace'\n    ]\n    bg = random.choice(bg_colors)\n\n    tk.Label(\n        window,\n        text=tip,\n        bg=bg,\n        font=('\u5fae\u8f6f\u96c5\u9ed1', 16),\n        width=30,\n        height=3\n    ).pack()\n\n    window.attributes('-topmost', True)\n    window.mainloop()\n    \nthreads = &#91;]\n\nfor i in range(300):\n    t = threading.Thread(target=show_warm_tip)\n    threads.append(t)\n    time.sleep(0.005)  \n    threads&#91;i].start()<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python\u4ee3\u7801<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2119","post","type-post","status-publish","format-standard","hentry","category-1"],"_links":{"self":[{"href":"https:\/\/womeifei.cn\/index.php\/wp-json\/wp\/v2\/posts\/2119","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/womeifei.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/womeifei.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/womeifei.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/womeifei.cn\/index.php\/wp-json\/wp\/v2\/comments?post=2119"}],"version-history":[{"count":5,"href":"https:\/\/womeifei.cn\/index.php\/wp-json\/wp\/v2\/posts\/2119\/revisions"}],"predecessor-version":[{"id":2141,"href":"https:\/\/womeifei.cn\/index.php\/wp-json\/wp\/v2\/posts\/2119\/revisions\/2141"}],"wp:attachment":[{"href":"https:\/\/womeifei.cn\/index.php\/wp-json\/wp\/v2\/media?parent=2119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/womeifei.cn\/index.php\/wp-json\/wp\/v2\/categories?post=2119"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/womeifei.cn\/index.php\/wp-json\/wp\/v2\/tags?post=2119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}