In this tutorial, we will be building a "Task Manager" mobile app using the Kivy framework and Python. The app will allow users to create, edit, delete, and mark tasks as complete. Kivy is an open-source Python library for developing multi-touch applications that can run on Android, iOS, Windows, Linux, and macOS.
To get started, make sure you have Python installed on your machine. You can download Python from the official website (https://www.python.org/downloads/). Once you have Python installed, you can install the Kivy library by running the following command in your terminal:
pip install kivy
Next, create a new Python file for our app and import the necessary modules:
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.button import Button
from kivy.uix.label import Label
from kivy.uix.textinput import TextInput
from kivy.uix.scrollview import ScrollView
Next, we will define our main app class and create a layout for our app:
class TaskManagerApp(App):
def build(self):
self.tasks = []
# Create a main vertical layout
layout = BoxLayout(orientation='vertical')
# Create a scroll view to display tasks
scroll_view = ScrollView()
task_layout = BoxLayout(orientation='vertical', size_hint_y=None)
# Add tasks to task_layout
for task in self.tasks:
task_label = Label(text=task)
task_layout.add_widget(task_label)
scroll_view.add_widget(task_layout)
# Create input fields for adding new tasks
task_input = TextInput(multiline=False)
add_button = Button(text="Add Task")
add_button.bind(on_press=self.add_task)
layout.add_widget(scroll_view)
layout.add_widget(task_input)
layout.add_widget(add_button)
return layout
def add_task(self, instance):
# Get the text from the input field
task_text = instance.parent.children[1].text
# Add the task to the tasks list
self.tasks.append(task_text)
# Clear the input field
instance.parent.children[1].text = ''
# Update the display
task_layout = instance.parent.children[0].children[0]
task_label = Label(text=task_text)
task_layout.add_widget(task_label)
if __name__ == '__main__':
TaskManagerApp().run()
In the code above, we create a vertical BoxLayout for our app and a ScrollView to display tasks. We also create input fields for adding new tasks and a button to add the task to the list. The add_task
method is called when the button is pressed, adding the task to the tasks
list and updating the display.
To run the app on your machine, save the code to a Python file (e.g., task_manager.py) and run it using the Python interpreter:
python task_manager.py
You should see a window with the task manager app running. You can enter tasks in the input field and click the "Add Task" button to add them to the list. The tasks will be displayed in the scroll view.
From here, you can expand the functionality of the app by adding features such as editing tasks, deleting tasks, marking tasks as complete, and saving tasks to a file. You can also customize the app’s appearance by adding styling and layouts.
I hope this tutorial helps you get started with building a task manager mobile app using the Kivy framework and Python. Happy coding!
How do you build for mobile, you just run in PC, not in mobile? I tried a random number generator with Kivy/Python, and compiling took more than 30 minutes. It's just a simple window with a random generator. This is a waste of time. "
BTW, IT'S NOT FINISHED. I JUST GAVE UP AND CLOSED THE WHOLE COMPILE PROCESS."
btw i use arch linux
Where can I find more tutorials like this working with kivy 😢?
Thank you for this tutorial. I have learned a lot of things. However, I ran into an issue. The plus icon can only be clicked once to add a task. After adding the first task, the icons will not click again until I close the app and relaunch it. Is there any solution to this? I have searched StackOverflow and I didn't get the solution.
Apk?
Can Kivy use to dev for stock market apps with data and charts?
Awesome video! Could you please do a video of how you go t your terminal the way you do
i am getting version clash. which python verson you are using and which kivy verson you are using?
Looks amazing😁
Why my pipenv shell is not working in terminal
I want to use fastAPI and sql library of python can you make a vedio on that
does this code bring the same functions of TASKER?
is it possible to integrate kivy with Django?
bro, your code cannot be cloned. Tried it a couple of times in vs code. And when i download the code it gives me something else
After watching the video like 3 times I was able to use A LOT of your code as inspiration to create my first own app.
Do you have any recommendations or information regarding the conversion of the project to an .apk file in windows? Thx a lot!
i am unable to sync kv file to python file please help me
Subscribed!
Would love to learn more Kivy tutorials / projects.
Thanks Bek, a well paced and clear tutorial, much appreciated 👍🙏
amazing tutorial. loving it so far.
IF anyone want to have it darkmode, just add following line of code after def build(self):
self.theme_cls.theme_style = "Dark"
self.theme_cls.primary_palette = ("Teal")
wow how come your powershell terminal is so moded? what did you do to it? thanks for the tutorial im only starting it but im sure its gonna be good. hard to find some new nice looking kivy app tutorials.
Thanks for your work!