#๐ TOP APP BAR AND BOTTOM APP BAR IN KIVY
399 messages ยท Page 1 of 1 (latest)
@void plinth
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
what framework is this?
kivy
@void plinth does it show anything on the screen
send screenshots
also, ffs, come on
use
KivyMD
it looks correct?
nope
not really
#create a design
MDScreen:
MDBoxLayout:
orientation: "vertical"
MDTopAppBar:
title: 'Task App Planner'
md_bg_color: [0.0196, 0.2196, 0.0039, 1]
left_action_items: [['menu', lambda x: print('menu')]]
right_action_items: [['magnify', lambda x: print('search')], ['dots-vertical', lambda x: print('vertical dots')]]
MDBottomAppBar:
md_bg_color: [0.0196, 0.2196, 0.0039, 1]
anchor: 'right'
mode: 'center'
icon: "plus"
left_action_items: [['delete', lambda x: print('delete')], ['pencil', lambda x: print('update')]]
lol
you changed it
That's the code i run just now
try and break it more... sometimes that helps to debug
# This is a message
right click my message
select Copy Text
then paste it in
i like that debugging method
#create a design
MDScreen:
MDBoxLayout:
orientation: "vertical"
MDTopAppBar:
title: 'Task App Planner'
md_bg_color: [0.0196, 0.2196, 0.0039, 1]
left_action_items: [['menu', lambda x: print('menu')]]
right_action_items: [['magnify', lambda x: print('search')], ['dots-vertical', lambda x: print('vertical dots')]]
MDBottomAppBar:
md_bg_color: [0.0196, 0.2196, 0.0039, 1]
anchor: 'right'
mode: 'center'
icon: "plus"
left_action_items: [['delete', lambda x: print('delete')], ['pencil', lambda x: print('update')]]
I cant find that mark in my keyboard so never used it
you could've asked
what happens if you comment out MDTopAppBar
slow down and just methodically change it
send screenshots
is the problem that is so far down the screen?
gone
nothing on the screen?
my problem is. bottom app bar does not display the content
if you comment out top bar there is nothing on the screen?
so maybe you need some more content under the topbar so it renders properly?
im still here btw im just reading the docs
what does "mode: 'center'" do
it's for flaoting action button
is bottom app bar supposed to be just the floating action button?
wdym?
if you change the background color of the bottom app bar does your bar change color correctly?
it looks like it's about at the height where a floating action button would be
good idea
seems fixed
yeah
the buttons not appearing
i was looking at an example and for the floating action button they have everything under MDFabBottomAppBarButton
aren't they hidden in the hamburger?
under MDBottomAppBar
oh nm, i'll shutup
Floating Action Bar
which thing?
looks like MDBottomAppBar doesnt have left_action_items
nope. I need to put content in the hamburger later
see the docs
it doesnt support that attribute
wait no
but left_action_items is not in the MDTopAppBar too
They also have MDBottomAppBar under FloatLayout
most latest
and that is?
if you look at the docs the latest version doesnt use left_action_items and right_action_items anymore
MDScreen:
md_bg_color: self.theme_cls.backgroundColor
MDBottomAppBar:
id: bottom_appbar
action_items:
[
MDActionBottomAppBarButton(icon="gmail"),
MDActionBottomAppBarButton(icon="bookmark"),
]
this is the example they gave
I'll try it
check the exact version of your kivyMD
v3.13.5
kivyMD, not kivy python
1.2.0
can you upgrade to 2.0.0?
also that's your python version
it looks like the kivyMD docs doesnt have the 1.2.0 version anymore
I can't help if I don't have the documentations
hang on
kivy is different from kivyMD
kivy current release seems to be 2.3.1
kivyMD seems to be 2.0.0
also pypi kivyMD is outdated?
(from kivy>=2.2.0->kivymd) (0.1.5)
where are you getting this from
nope, installed it now
Successfully installed asyncgui-0.6.3 asynckivy-0.6.4 exceptiongroup-1.3.0 kivymd2-2.0.1 materialyoucolor-2.0.10
you should be able to uninstall this one btw
the 1.2.0 version
how
it looks like they left it there to support legacy apps
are you using a package manager?
you mean older apps?
yea, there are older apps written with the old version that would break
wdym? should i say vs terminal?
so, essentially a package manager handles these packages for your projects,
sample?
someone can download your project source code, and then run a command to install only the libraries needed for your project
uv is one of the most popular package manager
to install kivy you would run uv add kivy
for example
so you are not using a package manager?
Successfully uninstalled kivymd-1.2.0\
close vs code and open it again
just to make sure we are working with the correct environment
do your import code have errors saying kivyMD is not installed?
im just concerned that they might be using different module name or something
ModuleNotFoundError: No module named 'kivymd.app'
ok let me check the correct module name
actually you know what, im going to create a project to make sure that it is correct first
aight
ill wait
im using uv btw
so it does all the things automatically
if you want you can try it too
@void plinth im back
it looks like the module name is still kivyMD
teach me how
I'll reinstall it
no
as in
kivymd2 is the correct library
but you import it with kivyMD
from kivymd import kivymd seems to be correct
@void plinth im here now
it highlights my import
do you want to redo this project over, and you can learn how to use a package manager?
sure
i will guide you to here
and then you can go from there
https://docs.astral.sh/uv/getting-started/installation/ follow the instructions here
uv is an extremely fast Python package and project manager, written in Rust.
to install uv
obviously choose the correct OS you are using
lmk when you are done
do you use windows?
ye
follow the instructions from here
uv is an extremely fast Python package and project manager, written in Rust.
done it
this is all you need actually
do you have a folder where you keep your coding projects?
ain't what im using fine?
what do you mean?
ahh mb. YEs
open powershell
and navigate to that folder
cd C:\the\folder\you\save\your\projects\in
done
if you type pwd does it show the folder path
yeah
done
this will create a subfolder inside your coding projects folder
with the name of your project
this folder will contain everything you need to run this project
aight, made it
including its own python, its own environment
open the folder uv created, in vscode
your sidebar has something like this?
are you sure this is the folder uv created?
yeah
if you look at mine, the toml file is in the topmost folder
i don't get it
so vscode can open folders right?
yeah
your vscode should open the folder Nyx, not the folder PythonProject
it opened nyx
correct
aight
create a folder .vscode
we need a config file to let vscode know to use the python inside our project
done
create a file inside .vscode with the name settings.json
done
wait i just noticed
pycharm automatically did this in my projects before
you dont have a venv folder?
I don't even know that
this is the folder that uv created are you sure?
yes
hmmmmm
[project]
name = "nyx"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
requires-python = ">=3.13"
dependencies = []
it did
its above vscode
oh
ok
that's good
in the vscode folder create settings.json
and then inside the file
{
"python.defaultInterpreterPath": "${workspaceFolder}/.venv/bin/python"
}
save the file and restart vscode
done
open vs code terminal
and
screenshot
does it activate the environment automatically?
wdym?
done
it didnt run anything?
PS C:\xampp\htdocs\MyFiles\PythonProject\Nyx> & C:/xampp/htdocs/MyFiles/PythonProject/Nyx/.venv/Scripts/Activate.ps1
& : File C:\xampp\htdocs\MyFiles\PythonProject\Nyx.venv\Scripts\Activate.ps1 cannot be loaded because running scripts is disabled
on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:3
- & C:/xampp/htdocs/MyFiles/PythonProject/Nyx/.venv/Scripts/Activate.ps ...
-
+ CategoryInfo : SecurityError: (:) [], PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess
PS C:\xampp\htdocs\MyFiles\PythonProject\Nyx>
ah ok


from https://docs.python.org/3/library/venv.html
Note
On Microsoft Windows, it may be required to enable the Activate.ps1 script by setting the execution policy for the user. You can do this by issuing the following PowerShell command:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
what?
run this in your vscode terminal
ok we are almost there
yipee
done
uv run main.py should open the app
done
does it run?
wdym
hmmmm
hold on
try changing your KV to this
KV = """
#:import MDActionBottomAppBarButton kivymd.uix.appbar.MDActionBottomAppBarButton
MDScreen:
md_bg_color: self.theme_cls.backgroundColor
MDTopAppBar:
id: top_appbar
type: "small"
pos_hint: {"center_x": 0.5, "top": 1}
MDTopAppBarLeadingButtonContainer:
MDActionTopAppBarButton:
icon: "arrow-left"
MDTopAppBarTitle:
text: "AppBar small"
MDTopAppBarTrailingButtonContainer:
MDActionTopAppBarButton:
icon: "attachment"
MDActionTopAppBarButton:
icon: "calendar"
MDActionTopAppBarButton:
icon: "dots-vertical"
MDBottomAppBar:
id: bottom_appbar
action_items:
[
MDActionBottomAppBarButton(icon="gmail"),
MDActionBottomAppBarButton(icon="bookmark"),
]
MDFabBottomAppBarButton:
icon: "plus"
on_release: app.change_actions_items()
"""
@void plinth
aight
this is what you should get
and this will be a good place for you to continue making your app
do you understand what the code does btw
do you think i can leave you at that?
anyway, how to add kivy again?
...
I'll ping you if not
what
uv add kivy?
and?
essentially how it works is like this:
but i also need the normal kivy
your app needs kivyMD
and kivyMD needs kivy
so kivy has already been installed automatically
ohhhhhhhhhhhhhhhhh
it also does not look like you need kivy as a dependency other than for kivyMD to work
I can already see how I can complete this project
with kivyMD alone
no not really
this just comes with experience
you will be able to write apps fluently in less time than it took me
wdym
what's your usual syntax
title: 'Task Planner'
theme_bg_color: 'Custom'
md_bg_color: [0.0196, 0.2196, 0.0039, 1]
left_action_items: [['menu', lambda x: 'menu']]
right_action_items: [['pencil', lambda x: 'update'], ['delete', lambda x: 'delete']]
Hey @void plinth!
```py
print('Hello, world!')
```
This will result in the following:
print('Hello, world!')```
i tried and yup,,,,it doesn't show content HAHA
you will need to use the new syntax
do you know how to use it?
take some time to look at the kivymd docs
and i will try to get something working in the mean time
yeah. i learned to learn the syntax from scratch
yeah
this is troublesome, I think I'll get seizure trying to memorise the bar HAHA
memorise the bar?
line of code of toolbar
you are not supposed to memorise it
anyway. I can't find anything on youtube which tackles about version 2
if you are just following youtube tutorials you wont be able to learn anything
documentary are complicated
I need someone to explain it to me in Layman's term
well yea im working on it
do you have an idea of how you want the app to look like?
i basically have an idea of how to get it to work now
you can draw it out on paper, in powerpoint, or anything really
basically just like memo
I think this is all
yeah, luckily, other than toolbar nothing much changed
alright
do you want to get to this toolbar or no?
that was your original design
can u show me your idea?
it's not my idea, that's what your original code does
ohh, this is a much better design
that is your own design
lmao. wait ill redo mine
should i integrate update and add?
and get rid of plus button
ohh btw. i still have a problem with traversing array. can u help me ?
mmmm i think that is a question you can ask in pydis so that more people can learn too
not everyone reads these threads
aight
ye
if you need help with reading the kivymd documentations you can ask me here though
I can't see anyone teaching through vc here now
it is incredibly important that you learn to read documentations
Aight that's cool. I will, I liked it. Maybe I'll compile this work of mine
can u recommend a Virtual Space thats not heavy and with linux
ask in #python-discussion
what is virtual space
hmm something like emulator?
for what purpose
you should be able to use WSL?
and I don't have phone so pydroid ain't possible
whats that?
i think this question will be better asked in #python-discussion because i dont use windows anymore i cant test things before I answer you
aight
@versed fjord
menu_items = [
{"text": "Profile", "on_release": lambda: self.menu_callback("Profile")},
{"text": "Settings", "on_release": lambda: self.menu_callback("Settings")},
{"text": "Logout", "on_release": lambda: self.menu_callback("Logout")},
]
can u explain this to me
and what can I customize it with?
what do you mean customize
where did you get this
i have no idea what this even means
but i can't understand its explanantion
This help channel has been closed. Feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.
