Package: tkf
This project is deprecated. Please useGaspiuminstead. Gaspium is a better framework for a lot of reasonsTkFLightweight Tkinter-based framework to build Python appsThis project is part of thePyrustic Open Ecosystem.Installation|Documentation|LatestTable of contentsOverviewDemoInstallationExternal learning resourcesGaspiumOverviewThis package includes several other packages and above all exposestkf.App, the main class of the framework.Main classThe main classtkf.Appallows you to:display the first view of the application;activate the theme of your choice;define the width and height of the app window;center the application window on the screen;make the application window full screen;restart the application;stop the application;et cetera.ExampleThis is an example of usage oftkf.App:Click to expand or collapseimporttkinterastkfromtkfimportAppfromcyberpunk_themeimportCyberpunkdefget_view(app):"""This is a view function"""root=app.root# Bodybody=tk.Frame(root)# Label 'Hello Friend'label=tk.Label(body,text="Hello Friend")label.pack(pady=10)# Button 'Quit'button=tk.Button(body,text="Quit",command=app.exit)button.pack(pady=10)# Return the body of this viewreturnbody# An instance of tkf.Appapp=App()# Sizeapp.geometry="300x100"# Titleapp.title="Example"# Cyberpunk is a dark themeapp.theme=Cyberpunk()# A view is either a function that returns a Tkinter widget# or a Viewable (see the library Viewable)app.view=get_view# Center the window on the screenapp.center()# Start the app (mainloop !)app.start()And this is what it looks like:ExampleRead more about the classtkf.App.Batteries includedThese are the packages included in TkF:LibrariesNameDescriptionSharedLibrary to store, expose, read, and editcollectionsof dataTkStyleLibrary to createstylesandthemesfor Python appsLitemarkLightweightMarkdowndialect for Python appsMegawidgetCollection ofmegawidgetsto build graphical user interfaces for Python appsViewableClass to implement a GUI view withlifecycleThreadomTkinter-compatiblemultithreadingSuggestionDemocratizingauto-complete(suggest) for Python desktop applicationsKurlKonnection URL:HTTP requestsin Python with an implementation ofconditional requestand aresponses cachingsystemLitedaoLibrary to perform intuitive interaction withSQLitedatabaseProbedProbedcollectionsfor PythonNote: The libraries listed above can be downloaded fromPyPIand installed individually for use as is in new or existing projects without having to use theTkFframework.ThemesNameDescriptionCyberpunk-ThemeA moderndark themefor Python appsWinter-ThemeA modernlight themefor Python appsNote: The themes listed above can be downloaded fromPyPIand installed individually for use as is in new or existing projects without having to use theTkFframework.Command line toolsNameDescriptionBackstageCLItool to manage, test, build, and release your PythonprojectsNote: The tools listed above can be downloaded fromPyPIand installed individually for use as is in new or existing projects without having to use theTkFframework.DemoHere is a demo that you can copy and paste and run as is:Click to expand or collapseimporttkinterastkfromtkfimportAppfromviewableimportViewablefrommegawidgetimportToastfromcyberpunk_themeimportCyberpunkfromcyberpunk_theme.widget.buttonimportget_button_red_style,get_button_blue_styleclassHello(Viewable):"""Graphical equivalent of a Hello World"""def__init__(self,app):super().__init__()self._app=appself._root=app.rootself._btn_max=Nonedef_build(self):"""This method is part of the view lifecycle"""self._body=tk.Frame(self._root)self._root.geometry("500x300")# Labellabel=tk.Label(self._body,text="Hello Friend !")label.pack(expand=1,fill=tk.BOTH)# Footerfooter=tk.Frame(self._body)footer.pack(side=tk.BOTTOM,fill=tk.X,padx=2,pady=2)# Button Maximizeself._btn_max=tk.Button(footer,text="Maximize",command=self._on_click_btn_max)self._btn_max.pack(side=tk.RIGHT,padx=(2,0))# Button Crashbtn_crash=tk.Button(footer,text="Crash",command=self._on_click_btn_crash)btn_crash.pack(side=tk.RIGHT)# Stylingbutton_red_style=get_button_red_style()button_blue_style=get_button_blue_style()button_red_style.target(btn_crash)button_blue_style.target(self._btn_max)def_on_click_btn_max(self):self._app.maximize()self._btn_max.destroy()def_on_click_btn_crash(self):toast=Toast(self._body,message="This app is going to crash...")toast.wait_window()self._app.crash_resistant=FalseraiseException("Deliberately raised exception !")defmain():# The Appapp=App()# Set the titleapp.title="demo"# Resizableapp.resizable=(True,True)# Set the themeapp.theme=Cyberpunk()# Set the viewapp.view=Hello# Center the window on the screenapp.center()# Lift off !app.start()if__name__=="__main__":main()And this is what it looks like:DemoInstallationTkFiscross platformand versions under1.0.0will be consideredBetaat best. It is built onUbuntuwithPython 3.8and should work onPython 3.5or newer.For the first timepipinstalltkfUpgrade$pipinstalltkf--upgrade--upgrade-strategyeagerExternal learning resourcesSome interesting links below to get started withPython,TkinterandSQLite.Introduction to Pythonpython-guidepython tutorialfreeCodeCamp onYoutubeIntroduction to Tkintertkdocstkinter tutorialfreeCodeCamp onYoutubeIntroduction to SQLitesqlitetutorialfreeCodeCamp onYoutubeNote:I am not affiliated with any of these entities. A simple web search brings them up.GaspiumGaspiumis a high-productivity framework for buildingGASPapplications. Under the hood,GaspiumusesTkF. IfTkFis C,Gaspiumwould be Python.DiscoverGaspium!