{"id":824,"date":"2022-07-19T18:22:39","date_gmt":"2022-07-19T10:22:39","guid":{"rendered":"https:\/\/huiyu1688.top\/?p=824"},"modified":"2022-07-19T18:22:40","modified_gmt":"2022-07-19T10:22:40","slug":"%e6%96%87%e4%bb%b6%e7%9b%ae%e5%bd%95%e6%a0%bc%e5%bc%8f%e5%8c%96%e5%b0%8f%e5%b7%a5%e5%85%b7%e3%80%90python%e6%ba%90%e7%a0%81%e3%80%91","status":"publish","type":"post","link":"https:\/\/hy68.top\/index.php\/2022\/07\/19\/824\/","title":{"rendered":"\u6587\u4ef6\u76ee\u5f55\u683c\u5f0f\u5316\u5c0f\u5de5\u5177\u3010python\u6e90\u7801\u3011"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code># coding=utf-8\n\n#main.py\nimport tkinter.messagebox as msBox\nimport time\nimport tkinter as tk\nfrom tkinter import END, W\nimport os\n\n#***************\u5f00\u59cb\u5efa\u6863\u6309\u94ae\u54cd\u5e94\u7a0b\u5e8f*******************\ndef startCreatDirClick():\n\u00a0 \u00a0 err_str = r'\\\/:*?\"&lt;>|'\n\u00a0 \u00a0 err_flag = False\n\u00a0 \u00a0 input_str = en_num.get()\n\u00a0 \u00a0 for s in err_str:\n\u00a0 \u00a0 \u00a0 \u00a0 if s in input_str:\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 err_flag = True\n\u00a0 \u00a0 if err_flag:\n\u00a0 \u00a0 \u00a0 \u00a0 msBox.showinfo(\"\u975e\u6cd5\u547d\u540d\",\"\u9879\u76ee\u540d\u79f0\u6587\u4ef6\u5939\u5305\u542b\u975e\u6cd5\u5b57\u7b26\uff0c\u5f53\u524d\u5efa\u6863\u5931\u8d25\uff01\")\n\u00a0 \u00a0 \u00a0 \u00a0 return\n\u00a0 \u00a0 # \u751f\u6210\u6307\u5b9a\u683c\u5f0f\u7684\u65f6\u95f4\u5b57\u7b26\u4e32\uff1a\n\u00a0 \u00a0 str_time = time.strftime(\"%m%d%H%M\",time.localtime())\n\u00a0 \u00a0 # \u5efa\u6863\u5b58\u50a8\u8def\u5f84\uff0c\u5982\u679c\u4e0d\u5b58\u5728\u5219\u65b0\u5efa\u4e00\u4e2a\n\u00a0 \u00a0 name_path = '{0}-&#91;\u526a\u8f91\u5b58\u6863_{1}]'.format(en_num.get(),str_time)\n\u00a0 \u00a0 fullName_path = os.getcwd() + '\\\\' + name_path \n\u00a0 \u00a0 if not os.path.exists(fullName_path):\n\u00a0 \u00a0 \u00a0 \u00a0 os.mkdir(fullName_path)\n\u00a0 \u00a0 \u00a0 \u00a0 os.mkdir(fullName_path+'\\\\\u6210\u54c1\u8f93\u51fa')\n\u00a0 \u00a0 \u00a0 \u00a0 os.mkdir(fullName_path+'\\\\\u5176\u4ed6')\n\u00a0 \u00a0 \u00a0 \u00a0 os.mkdir(fullName_path+'\\\\\u7d20\u6750\u5e93')\n\u00a0 \u00a0 \u00a0 \u00a0 os.mkdir(fullName_path+'\\\\\u9879\u76ee\u6253\u5305')\n\u00a0 \u00a0 \u00a0 \u00a0 msBox.showinfo(\"\u5efa\u6863\u6210\u529f\u63d0\u793a\",\"\u540d\u79f0\uff1a\u3010{0}\u3011\uff0c\u5df2\u5efa\u6863\u6210\u529f\u3002\".format(name_path))\n\u00a0 \u00a0 else:\n\u00a0 \u00a0 \u00a0 \u00a0 msBox.showinfo(\"\u91cd\u540d\",\"\u6587\u4ef6\u5939\u5df2\u5b58\u5728\uff0c\u8bf7\u6539\u540d\uff01\")\n#~~~~~~~~~~~~~ END startDrawClick func ~~~~~~~~~~~~~#\n\n#*************\u4e3b\u7a0b\u5e8f*************\n#\u521d\u59cb\u5316\u7a97\u53e3\nhyWin = tk.Tk()\n# \u8bbe\u7f6e\u7a97\u53e3\u5927\u5c0f\nwinWidth = 320\nwinHeight = 130\n# \u83b7\u53d6\u5c4f\u5e55\u5206\u8fa8\u7387\nscreenWidth = hyWin.winfo_screenwidth()\nscreenHeight = hyWin.winfo_screenheight()\n#\u8ba1\u7b97\u7a97\u4f53\u5c45\u4e2d\u540e\u7684X\u5750\u6807\u548cY\u5750\u6807 \np_x = int((screenWidth - winWidth) \/ 2)\np_y = int((screenHeight - winHeight) \/ 2)\n# \u8bbe\u7f6e\u4e3b\u7a97\u53e3\u6807\u9898\nhyWin.title(\"\u5efa\u6863\u5c0f\u5de5\u5177---\u526a\u8f91\u6587\u4ef6\u76ee\u5f55\u683c\u5f0f\u5316\")\n# \u8bbe\u7f6e\u7a97\u53e3\u56fe\u6807\n#hyWin.iconbitmap(\".\/img\/logo.ico\")\n# \u8bbe\u7f6e\u7a97\u53e3\u521d\u59cb\u4f4d\u7f6e\u5728\u5c4f\u5e55\u5c45\u4e2d\nhyWin.geometry(\"%sx%s+%s+%s\" % (winWidth, winHeight, p_x, p_y))\n#\u56fa\u5b9a\u7a97\u53e3\u5927\u5c0f\nhyWin.resizable(False,False)\n\n#------------------------------------\u4ee5\u4e0b\u662f\u7a97\u4f53\u7684\u63a7\u4ef6\u548c\u5e03\u5c40------------------------------------- \u00a0 \nlab_info = tk.Label(hyWin, text=\"\u8bf7\u8f93\u5165\u9879\u76ee\u540d\u79f0:\", font=('\u5b8b\u4f53', 12), width=14, height=1)\nlab_info.grid(row=0, column=0, padx=10, pady=10)\n\nen_num = tk.Entry(hyWin, show=None, width=12, font=('Arial', 12)) \u00a0# \u663e\u793a\u6210\u660e\u6587\u5f62\u5f0f\nen_num.grid(row=0, column=1, padx=5,pady=10)\nen_num.insert(0,\"\u672a\u547d\u540d\")\n\nlab_info2 = tk.Label(hyWin, text=\"\u9879\u76ee\u540d\u79f0\u4e2d\u4e0d\u80fd\u5305\u542b\u4ee5\u4e0b\u5b57\u7b26:\\\\\/:*?\\\"&lt;>|\", font=('\u5b8b\u4f53', 11), width=36, height=1)\nlab_info2.grid(row=1, column=0, columnspan=2, sticky=tk.NS, padx=5, pady=5)\n\u00a0 \u00a0 \u00a0 \u00a0 \nbtn_start = tk.Button(hyWin, text=\"\u5efa\u7acb\u683c\u5f0f\u5316\u76ee\u5f55\", font=('\u9ed1\u4f53', 13), width=16, height=1, fg=\"blue\", bg=\"white\", command=startCreatDirClick)\nbtn_start.grid(row=2, column=0, sticky=tk.NS, padx=15, pady=10)\n\nbtn_exit = tk.Button(hyWin, text=\"\u9000 \u51fa\", font=('\u9ed1\u4f53', 13), width=8, height=1, fg=\"blue\", bg=\"white\", command=hyWin.quit)\nbtn_exit.grid(row=2, column=1, sticky=tk.NS, padx=5, pady=10)\n#------------------------------------\u4ee5\u4e0a\u662f\u7a97\u4f53\u7684\u63a7\u4ef6\u548c\u5e03\u5c40------------------------------------- \u00a0 \n\nhyWin.mainloop()\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">>>>\u6e90\u7801\u8c03\u8bd5\u89c6\u9891\uff1a<\/h2>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/huiyu1688.top\/wp-content\/uploads\/2022\/07\/kk-2022-07-19-18-16-56.mp4\"><\/video><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u4ef6\u76ee\u5f55\u683c\u5f0f\u5316\u5c0f\u5de5\u5177&#8212;python\u6e90\u7801<\/p>\n","protected":false},"author":1,"featured_media":826,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11,2,8,7,6],"tags":[28],"_links":{"self":[{"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/posts\/824"}],"collection":[{"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/comments?post=824"}],"version-history":[{"count":1,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/posts\/824\/revisions"}],"predecessor-version":[{"id":827,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/posts\/824\/revisions\/827"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/media\/826"}],"wp:attachment":[{"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/media?parent=824"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/categories?post=824"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hy68.top\/index.php\/wp-json\/wp\/v2\/tags?post=824"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}