{"id":1622,"date":"2021-03-10T23:51:50","date_gmt":"2021-03-10T15:51:50","guid":{"rendered":"http:\/\/cnliutz.uicp.io\/?p=1622"},"modified":"2021-03-10T23:51:50","modified_gmt":"2021-03-10T15:51:50","slug":"tkinter%e5%9f%ba%e6%9c%acwidegets","status":"publish","type":"post","link":"http:\/\/g1n29wqq.ipyingshe.net:5347\/?p=1622","title":{"rendered":"tkinter\u57fa\u672cwidegets"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>from tkinter.messagebox import *\nfrom tkinter import *\nroot = Tk()\n\nphoto = PhotoImage(file=\".\/snow.png\")  #file\uff1at\u56fe\u7247\u8def\u5f84\nimgLabel = Label(root,image=photo,text=\"\u521d\u6625\u7684\u96ea\uff01\")     #\u628a\u56fe\u7247\u6574\u5408\u5230\u6807\u7b7e\u7c7b\u4e2d\nimgLabel.pack(side=RIGHT)           #\u81ea\u52a8\u5bf9\u9f50\n\ntl = \"This is my window\"\nroot.geometry(\"1024x900\")  #\u7a97\u53e3\u5927\u5c0f\nroot.title(tl)             #\u7a97\u53e3\u9898\u76ee\n\noriginal_background = root.cget(\"background\")  #\u5f97\u5230\u7a97\u53e3\u80cc\u666f\u8272\nprint(original_background)\n#root.configure(background=original_background)\nroot.configure(background=\"yellow\")  #\u8bbe\u7f6e\u7a97\u53e3\u80cc\u666f\u8272\ndata = StringVar()\ndef action():\n\tprint(\"I am  a Button!\")\n\troot.title(\"Click Me!\")\n\troot.geometry(\"+220+150\")\n\troot.update()\n\tbg = root.cget(\"background\") \n\tshowinfo(bg)  #\u5f39\u51fa\u4fe1\u606f\u7a97\u53e3\n\n\nlabel = Label(root,text=\"It's me!\")\nlabel.pack()\nbtn = Button(root,text=\"Enter\",command=action)\nbtn.pack()\nent = Entry(root,textvariable=data)\nent.pack()\nchk1 = Checkbutton(root,text=\"\u7535\u89c6\")\nchk2 = Checkbutton(root,text=\"\u7535\u8111\")\nchk3 = Checkbutton(root,text=\"\u7535\u5439\u98ce\")\nchk1.pack()\nchk2.pack()\nchk3.pack()\nfrm = Frame(root,bord=6)\nfrm.pack(side=\"top\")\ntext = Text(frm,width=30,height=6,background=\"light blue\")\ntext.pack()\nim = Image(\"\u96ea.jpg\",imgtype=\"jpg\")\nim.pack\n\nroot.mainloop()\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,10],"tags":[],"class_list":["post-1622","post","type-post","status-publish","format-standard","hentry","category-2","category-python"],"_links":{"self":[{"href":"http:\/\/g1n29wqq.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/posts\/1622","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/g1n29wqq.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/g1n29wqq.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/g1n29wqq.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/g1n29wqq.ipyingshe.net:5347\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1622"}],"version-history":[{"count":1,"href":"http:\/\/g1n29wqq.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/posts\/1622\/revisions"}],"predecessor-version":[{"id":1623,"href":"http:\/\/g1n29wqq.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/posts\/1622\/revisions\/1623"}],"wp:attachment":[{"href":"http:\/\/g1n29wqq.ipyingshe.net:5347\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1622"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/g1n29wqq.ipyingshe.net:5347\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1622"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/g1n29wqq.ipyingshe.net:5347\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1622"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}