{"id":21528270,"url":"https://github.com/hrassi/tkinter_starter","last_synced_at":"2025-07-10T22:41:28.748Z","repository":{"id":220785745,"uuid":"752602122","full_name":"hrassi/tkinter_starter","owner":"hrassi","description":null,"archived":false,"fork":false,"pushed_at":"2024-02-04T10:38:01.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-24T06:09:44.618Z","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/hrassi.png","metadata":{"files":{"readme":"readme.txt","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}},"created_at":"2024-02-04T10:31:45.000Z","updated_at":"2024-02-04T10:37:19.000Z","dependencies_parsed_at":"2024-02-04T10:54:27.207Z","dependency_job_id":null,"html_url":"https://github.com/hrassi/tkinter_starter","commit_stats":null,"previous_names":["hrassi/tkinter_starter"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrassi%2Ftkinter_starter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrassi%2Ftkinter_starter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrassi%2Ftkinter_starter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hrassi%2Ftkinter_starter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hrassi","download_url":"https://codeload.github.com/hrassi/tkinter_starter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244091770,"owners_count":20396667,"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-11-24T01:52:26.128Z","updated_at":"2025-03-17T18:44:50.280Z","avatar_url":"https://github.com/hrassi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"Python tkinter:\n\nimport tkinter as tk\nfrom PIL import Image, ImageTk\nfrom tkinter.filedialog import askopenfile\nimport PyPDF2 # to extract text from pdf\n\nroot = tk.Tk()   # begining of our interface\n\nroot.mainloop() # end command of interface\n\n# all elements we put between this 2 lines  \n# root=tk.Tk() and root.mainloop() will apear\n# inside our window object \n\n# to precise the dimention of our window\n# object we create a variable called canvas\n# then we divide the window to 3 imaginary\n# column with Canvas.grid() to place our \n#elements precisely\n\ncanvas = tk.Canvas(root, width=600, height=300)\n\nCanvas.grid(columnspan=3)\n\n# now To place an image we create a new\n# variable : logo \n\nlogo = Image.open(‘file.png’) \n\n# then we convert this pillow image to \n# tkinter image by typing this :\n\nlogo= ImageTk.PhotoImage(logo)\n\n# then we place the image inside a label \n# widget to apear :\n\nlogo_label = tk.Label(image=logo)\nlogo_label.image=logo\nlogo_label.grid(column=1, row=0)\n\n# to add instruction text :\n\ninstructions = tk.Label(root, text=“Select a PDF file on your computer”, font=“Raleway”)\n\ninstructions.grid(columnspan=3 , column=0,row=1)\n\n# to add a browse button that change its caption : \n\nbrowse_text = tk.StringVar()\n\nbrowse_btn = tk.Button(root,textvariable =browse_text, command=lambda:open_file(), font=“Raleway” ,bg=“#20bebe”,fg=“white”, height=2, width=15)\n\nbrowse_text.set(“Browse”)\n\nbrowse_btn.grid(column=1,row=2)\n\n# then we add a fuction in the beginning that will\n# be lunched when we push the button due to the\n# command  =lambda:open_file()\n# to open browser and chose a file on pc\n# need now to import askopenfile from \n# tkinter.filedialog\n\ndef open_file():\n    browse_text.set(“loading…”) # change caption \n                                                     # butn to loading\n    file=askopenfile(parent=root,mode=‘rb’,title=“choose a file”,filetype=[(“Pdf file”, “*.pdf”)])\n\nif file:                  # if file is selected\n     read_pdf=PyPDF2.PdfFileReader(file) \n                             # read file and store it in vars   \n                             # read_pdf\n     page = read_pdf.getPage(0)\n     page_content = page.extractText()\n\n     # now writing the content in a text box :\n\n      text_box = tk.Text(root,height=10 ,width=50, \n      padx=15, pady=15)\n\n      text_box.insert(1.0, page_content)\n      text_box.grid(column=1, row=3)\n\n      # at the end reset caption of btn to browse:\n\n       browse_text.set(“Browse”)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrassi%2Ftkinter_starter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhrassi%2Ftkinter_starter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhrassi%2Ftkinter_starter/lists"}