{"id":15443370,"url":"https://github.com/0xff-dev/tkinter","last_synced_at":"2025-03-28T07:41:09.626Z","repository":{"id":104627369,"uuid":"181916617","full_name":"0xff-dev/tkinter","owner":"0xff-dev","description":"python GUI  ✌🏻","archived":false,"fork":false,"pushed_at":"2019-07-17T12:58:30.000Z","size":6,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-02T08:27:26.642Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0xff-dev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-04-17T15:12:44.000Z","updated_at":"2019-07-17T12:58:31.000Z","dependencies_parsed_at":null,"dependency_job_id":"319521ca-8677-4159-8952-0205314cfcfc","html_url":"https://github.com/0xff-dev/tkinter","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xff-dev%2Ftkinter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xff-dev%2Ftkinter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xff-dev%2Ftkinter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xff-dev%2Ftkinter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xff-dev","download_url":"https://codeload.github.com/0xff-dev/tkinter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245991561,"owners_count":20706125,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T19:34:42.734Z","updated_at":"2025-03-28T07:41:09.621Z","avatar_url":"https://github.com/0xff-dev.png","language":"Python","readme":"# tkinter\npython GUI  ✌🏻\n\n## 按钮与事件的绑定\n1. 通过`command`绑定\n```python\ndef new_label():\n    global root\n    label = Label(root, text=\"lable\")\n    label.pack()\n\nroot = Tk()\nbtn = Button(paretn, command=func)\nbnt.pack()\nroot.mainloop()\n```\n\n2. `bind`完成事件的绑定\n\u003e `bind(event_type, event_func)`\n\u003e 事件介绍 \u003cButton-1\u003e鼠标左键，\u003cButton-3\u003e鼠标右键, \u003cKeyPress-A\u003e按下A, B 等按键. \u003cControl-C/V\u003e \u003cF1-12\u003eF按键\n\u003e `bind`函数可以做全程序级别的绑定`bind_all`, 全局绑定快捷键. `bind_class` 绑定类别。`w.bind_class(\"Entry\", \"\u003cControl-V\", func)` 所有的输入框具有粘贴功能.\n\u003e 解除绑定`unbind`\n```python\ndef new_label(event):\n    global root\n    label = Label(root, text=\"lable\")\n    label.pack()\n\nroot = Tk()\nbtn = Button(root, text=\"Button1\")\nbtn.bind(\"\u003cButton-1\u003e\", new_lable)\nbnt.pack()\nroot.mainloop()\n```\n\n## 菜单\n\u003e Menu(parent), 使用`add_command`增加菜单， `add_cascade`及联添加子选项.\n\u003e 弹出菜单, 由`Menu.post`制作\n\u003e `add_separator`为菜单添加分割线.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xff-dev%2Ftkinter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xff-dev%2Ftkinter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xff-dev%2Ftkinter/lists"}