KivyMD TopAppBar mode: "free-center" not working - kivymd

I'm trying to create a toolbar at the bottom of the screen, with a button of mode "free-center" as displayed in the documentation: https://kivymd.readthedocs.io/en/1.1.1/components/toolbar/index.html
Here is my the toolbar in my .kv file:
MDBottomAppBar:
MDTopAppBar:
icon: "camera"
type: "bottom"
mode: "free-center"
The toolbar is displayed, however the button with a camera icon is displayed in the "free-end" position. Setting mode to "center", "free-end", or "end" displays the correct position, however mode: "free-center" doesn't seem to be working.
These are my Kivy-related requirements:
Kivy==2.2.0.dev0
kivy-deps.angle==0.3.3
kivy-deps.glew==0.3.1
kivy-deps.gstreamer==0.3.3
kivy-deps.sdl2==0.5.1
Kivy-examples==2.2.0.dev0
Kivy-Garden==0.1.5
kivymd==1.1.1

This works as expected in the latest version stable version (v1.1.1 as of writing this). The documentation you linked is for v0.104.0 which is quite old. Please upgrade your KivyMD to v1.1.1 or later.
python -m pip install kivymd --upgrade

Related

How to open and view CGNS files on Windows 10 after installing PyCGNS python package?

After installing PyCGNS python package from Anaconda distribution, I am not able to open CGNS files as recommended in the following pages using the command line CGNS.NAV or cg_look:
Browsing your CGNS tree with NAV
Here is the error message I am receiving whether I am running the command line in Git Bash, Powershels, or CMD:
CGNS.NAV: FATAL error, cannot import qtpy.QtCore...
Hints:
pyqt5 is already installed
print(sys.path)
'C:\\ProgramData\\Anaconda3\\Scripts', 'C:\\ProgramData\\Anaconda3\\python38.zi
p', 'C:\\ProgramData\\Anaconda3\\DLLs', 'C:\\ProgramData\\Anaconda3\\lib', 'C:\\
ProgramData\\Anaconda3', '', 'C:\\ProgramData\\Anaconda3\\lib\\site-packages', '
C:\\ProgramData\\Anaconda3\\lib\\site-packages\\vboxapi-1.0-py3.8.egg', 'C:\\Pro
gramData\\Anaconda3\\lib\\site-packages\\win32', 'C:\\ProgramData\\Anaconda3\\li
b\\site-packages\\win32\\lib', 'C:\\ProgramData\\Anaconda3\\lib\\site-packages\\
Pythonwin', 'C:\\ProgramData\\Anaconda3\\lib\\site-packages\\IPython\\extensions
', 'C:\\Users\\user_name\\.ipython']
You need to install PyQT.
Open the cmd.exe prompt from the anaconda navigator (in the home menu).
Execute this command:
conda install pyqt5
If you already had install it, maybe it's not in your enviroment.
Please post the output from:
print(sys.path)
Find out where PyQt5 is installed and ad it to your path-enviroment. You will find plenty of howto's in the internet. Here is one of them (Source: https://www.educative.io/edpresso/how-to-add-python-to-path-variable-in-windows):
Right-clicking This PC and going to Properties.
Clicking on the Advanced system settings in the menu on the left.
Clicking on the Environment Variables button o​n the bottom right.
In the System variables section, selecting the Path variable and clicking on Edit. The next screen will show all the directories that are currently a part of the PATH variable.
Clicking on New and entering Python’s install directory.

Terminal doesn't open window on top Mac - Atom

I am currently using Atom to code in Python3 on my Mac and I have a package installed ("atom-python-run") which launches a terminal window with the command "python3 {path}" with 'path' being the current working directory with filename.py included. It opens just fine and runs perfectly, but the window doesn't open on top of my atom window but behind it instead. I have to click it every time to see the terminal window and it's really frustrating. I also hate using CMD+Tab to find it as well.
This is a bug in the package I'm using (I think) and I don't want to wait for them to fix it. Are there any methods in OS X to ALWAYS open Terminal on top of every other window? Or a third-party application? I can't find a solution to this problem anywhere online.
If you install the scripts package and use it, the output will be written to a window in the Atom application and will be shown at completion. Go to the Atom package page and search for the word script. You should get a hit on the "script" package. Install this package by just clicking on the install button and then open Atom and the python script you wish to run. Now in Atom go to the packages menu item and from that menu select "script". You'll be given several options, choose "run script" and your script should run showing the output in a window at the bottom of the Atom window.

Anaconda VTK 8.2.0 in Visual Studio Code

I am just starting to use vtk with python.
I use Anaconda + VTK 8.2.0 (installed with Anaconda Navigator)
In VScode I tried the example: https://vtk.org/Wiki/VTK/Examples/Python/Cylinder
Result: It works, it shows a cylinder.
Problem: VScode highlights some 'problems':
No name 'util' in module 'vtk'
Unable to import 'vtk.util.colors'
...
example image
I think it has something to do with the pylint extension, but I don't know how to solve it.
Kind regards,
Kns
Solution (see also: https://stackoverflow.com/a/52260240/11216179 , post of BlakcRece )
In VS Code;
click on File > Preferences > Settings.
Scroll down to "Python Configurations" in the left window
scroll down to "Python Linting: Mypy Args" in the right window
click on "Edit in settings.json" link
edit the json to include: "--extension-pkg-whitelist=vtk"
( Or if you want to add all libraries: edit the json to include: "--extension-pkg-whitelist=all" )

KivyMD examples not getting correctly displayed

I've downloaded KivyMD on my windows machine from here
KivyMD path _ _ _\Python36-32\Lib\site-packages\kivymd
I'm trying to see how the widgets look with MD and when I run .py files I only get a blank window.
This seems to be the case for almost all examples (.py files) under the kivymd folder.
Appreciate any inputs.
.
cd ...\Python36-32\Lib\site-packages\kivymd\demos\kitchen_sink
run python main.py
Note
Not all .py programs in ...\Python36-32\Lib\site-packages\kivymd will display a window. You can run python accordion.py and it will display a window of accordion widget.

ModuleNotFoundError: No module named 'pygame'

I have python 3.7 with 32bit and after I did pip install pygame, I'm still getting
ModuleNotFoundError: No module named 'pygame'
when running my code. I'm using pycharm.
I would just like to add to what the first answer is saying:
If you are using pycharm, it still won't work until you go to file >> settings >> >> [your project name] >> python interpreter. You will see a list of packages there. If pygame is on it, then good, else, you must double click on the field where the packages are. It leads you to a little pop up box where you can type in things. If you type in pygame, you should be able to install the package.
To be sure that you installed the python3 proper module u need to use
pip3 install pygame
I ran into the same error a few days ago! Thankfully, I found the answer.
You see, the problem is that pygame comes in a .whl (wheel) file/package. So, as a result, you have to pip install it.
Pip installing is a very tricky process, so please be careful. The steps are:-
Step1. Go to C:/Python (whatever version you are using)/Scripts. Scroll down. If you see a file named pip.exe, then that means that you are in the right folder. Copy the path.
Step2. In your computer, search for Environment Variables. You should see an option labeled 'Edit the System Environment Variables'. Click on it.
Step3. There, you should see a dialogue box appear. Click 'Environment Variables'. Click on 'Path'. Then, click 'New'. Paste the path that you copied earlier.
Step4. Click 'Ok'.
Step5. Shift + Right Click wherever your pygame is installed. Select 'Open Command Window Here' from the dropdown menu. Type in 'pip install py' then click tab and the full file name should fill in. Then, press Enter, and you're ready to go! Now you shouldn't get the error again!!!
Probably you have several instances of Pythion on your computer. You may install pygame in one instance, but IDE uses another.

Resources