{"id":816,"date":"2026-03-26T22:11:20","date_gmt":"2026-03-26T18:11:20","guid":{"rendered":"https:\/\/avdeevk.ru\/?p=816"},"modified":"2026-03-26T22:11:22","modified_gmt":"2026-03-26T18:11:22","slug":"python-middle-auth-program","status":"publish","type":"post","link":"https:\/\/avdeevk.ru\/index.php\/2026\/03\/26\/python-middle-auth-program\/","title":{"rendered":"Python.Middle: \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438"},"content":{"rendered":"\n<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0447\u0435\u043c\u043f\u0438\u043e\u043d\u044b \u043f\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u0439 \u043f\u0435\u0447\u0430\u0442\u0438, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0449\u0435, \u0447\u0435\u043c \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u043b\u0430 \u0431\u044b\u0442\u044c:<\/p>\n\n\n\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c \u0432\u0438\u0434\u0435 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 VSCode \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/006.png\"><img loading=\"lazy\" decoding=\"async\" width=\"312\" height=\"171\" src=\"https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/006.png\" alt=\"\" class=\"wp-image-817\" srcset=\"https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/006.png 312w, https:\/\/avdeevk.ru\/wp-content\/uploads\/2026\/03\/006-300x164.png 300w\" sizes=\"auto, (max-width: 312px) 100vw, 312px\" \/><\/a><\/figure>\n\n\n\n<p>\u0422.\u0435 \u0423 \u043d\u0430\u0441 4 \u0444\u0430\u0439\u043b\u0430 \u0432\u0441\u0435\u0433\u043e:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>configuration.py &#8212; \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b, \u043a\u043e\u043d\u0444\u0438\u0433\u0443\u0440\u0438\u0440\u0443\u044e\u0449\u0438\u0435 \u043e\u043a\u043d\u043e<\/li>\n\n\n\n<li>checker.py &#8212; \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 Checker, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0434\u0430\u043d\u043d\u044b\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044f \u0438 \u0438\u043c\u0435\u0435\u0442 \u043c\u0435\u0442\u043e\u0434, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0439 \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0435\u043c\u0443 \u0432\u0432\u0435\u0434\u0451\u043d\u043d\u044b\u0435 \u043b\u043e\u0433\u0438\u043d-\u043f\u0430\u0440\u043e\u043b\u044c, \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0438\u0445 \u0441 \u0445\u0440\u0430\u043d\u0438\u043c\u044b\u043c\u0438 \u0438 \u0432\u044b\u0434\u0430\u0442\u044c \u0432\u0435\u0440\u0434\u0438\u043a\u0442 \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u044e\u0442 \u043e\u043d\u0438 \u0438\u043b\u0438 \u043d\u0435\u0442 \u0432 \u0432\u0438\u0434\u0435 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f True \u0438\u043b\u0438 False<\/li>\n\n\n\n<li>window.py &#8212; \u043e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430<\/li>\n\n\n\n<li>icon3.ico &#8212; \u0438\u043a\u043e\u043d\u043a\u0430 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f<\/li>\n<\/ul>\n\n\n\n<p>\u0418\u043a\u043e\u043d\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 https:\/\/www.icon-icons.com<\/p>\n\n\n\n<p><strong>\u0424\u0430\u0439\u043b configuration.py:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>WIN_TITLE = \"My window\"\nWIN_WIDTH = 800\nWIN_HEIGHT = 600\nWIN_ICON = \"icon3.ico\"<\/code><\/pre>\n\n\n\n<p><strong>\u0424\u0430\u0439\u043b checker.py:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Checker():\n    def __init__(self, login, password):\n        self._login = login\n        self._password = password\n\n    def check(self, login, password):\n        if login == self._login and password == self._password:\n            return True\n        else:\n            return False\n        \n<\/code><\/pre>\n\n\n\n<p>\u0424\u0430\u0439\u043b window.py:<\/p>\n\n\n\n<p>\u0422\u0443\u0442 \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043e\u043a\u043d\u0430, \u0432\u0441\u0435 \u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442 \u0442\u0438\u043f\u0430 Checker, \u043e\u0431\u044a\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0440\u0435\u0430\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b \u043d\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043b\u043e\u0433\u0438\u043d\u0430 \u0438 \u043f\u0430\u0440\u043e\u043b\u044f.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import tkinter as tk\nfrom configuration import *\nfrom checker import Checker\n\nmainWindow = tk.Tk()\nmainWindow.title(WIN_TITLE)\nmainWindow.geometry( f\"{WIN_WIDTH}x{WIN_HEIGHT}\" )\nmainWindow.iconbitmap(WIN_ICON)\n\ntxt = tk.Text(mainWindow, width=15, height=1)\ntxt.pack()\n\ntxt2 = tk.Text(mainWindow, width=15, height=1)\ntxt2.pack()\n\nchecker = Checker(\"ivan\",\"qwerty\")\n\ndef Auth():\n    log = txt.get(1.0,tk.END).strip()\n    pss = txt2.get(1.0,tk.END).strip()\n    print(log,pss)\n    if checker.check(log, pss): \n        print(\"\u0414\u043e\u0441\u0442\u0443\u043f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\")\n    else: \n        print(\"\u041d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435!\")\n\n\nbtn = tk.Button( mainWindow, text=\"\u0421\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u0440\u0438\u0432\u0435\u0442!\", command=Auth)\nbtn.pack()\n\nmainWindow.mainloop()<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u0422\u0430\u043a \u043a\u0430\u043a \u043c\u044b \u0447\u0435\u043c\u043f\u0438\u043e\u043d\u044b \u043f\u043e \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e\u0439 \u043f\u0435\u0447\u0430\u0442\u0438, \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0438\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0449\u0435, \u0447\u0435\u043c \u043e\u043d\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u043b\u0430 \u0431\u044b\u0442\u044c: \u0412 \u043e\u0431\u0449\u0435\u043c \u0432\u0438\u0434\u0435 \u043f\u0440\u043e\u0435\u043a\u0442 \u0432 VSCode \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0432\u043e\u0442 \u0442\u0430\u043a: \u0422.\u0435 \u0423 \u043d\u0430\u0441 4 \u0444\u0430\u0439\u043b\u0430 \u0432\u0441\u0435\u0433\u043e: \u0418\u043a\u043e\u043d\u043a\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043c\u043e\u0436\u043d\u043e \u0431\u0435\u0441\u043f\u043b\u0430\u0442\u043d\u043e \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u043d\u0430 \u0441\u0430\u0439\u0442\u0435 https:\/\/www.icon-icons.com \u0424\u0430\u0439\u043b configuration.py: \u0424\u0430\u0439\u043b checker.py: \u0424\u0430\u0439\u043b window.py: \u0422\u0443\u0442 \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u043e\u0441\u043d\u043e\u0432\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u044b \u043e\u043a\u043d\u0430, \u0432\u0441\u0435 \u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u044b, \u0441\u043e\u0437\u0434\u0430\u0451\u0442\u0441\u044f \u043e\u0431\u044a\u0435\u043a\u0442<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[30,31,12],"tags":[],"class_list":["post-816","post","type-post","status-publish","format-standard","hentry","category-topit","category-topit-tuts","category-tuts"],"_links":{"self":[{"href":"https:\/\/avdeevk.ru\/index.php\/wp-json\/wp\/v2\/posts\/816","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/avdeevk.ru\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/avdeevk.ru\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/avdeevk.ru\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/avdeevk.ru\/index.php\/wp-json\/wp\/v2\/comments?post=816"}],"version-history":[{"count":1,"href":"https:\/\/avdeevk.ru\/index.php\/wp-json\/wp\/v2\/posts\/816\/revisions"}],"predecessor-version":[{"id":818,"href":"https:\/\/avdeevk.ru\/index.php\/wp-json\/wp\/v2\/posts\/816\/revisions\/818"}],"wp:attachment":[{"href":"https:\/\/avdeevk.ru\/index.php\/wp-json\/wp\/v2\/media?parent=816"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/avdeevk.ru\/index.php\/wp-json\/wp\/v2\/categories?post=816"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/avdeevk.ru\/index.php\/wp-json\/wp\/v2\/tags?post=816"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}