Python Basic Useage Inneoemacs
2023-12-01
3 min read
I don’t use python much, but I still record the useful information.
pyenv
Use pyenv download a python version and shift to that particular version.
-
install pyenv
1 brew install pyenv
-
set on fish
1 set PYENV_ROOT $HOME/.pyenv 2 set -x PATH $PYENV_ROOT/shims $PYENV_ROOT/bin $PATH 3 pyenv rehash
TODO: there lack of a settlment about bash
-
pyenv usage
Use pyenv global shift to a particular verison , will effect the python and pip lib version.
1 pyenv install 3.11 2 pyenv global 3.11 3 python -V 4 pip -V
emacs compile
-
emacs lsp langrage
M-x
lsp-install-server pyright -
compile
Use compile-command binding toSPC c c
for custom the compile command.# -*- compile-command: "python test.py"; -*- """this is the doc.""" thisdict = { "brand": "Ford", "model": "Mustang", "year": 1964 } print(thisdict)
manim
Manim can easily draw animated videos.
To become familiar with its use you may need to study for 1 day.
I think there may be a good start https://www.youtube.com/watch?v=q34jwI4zcMY.
Official documentation:https://docs.manim.community/en/stable/
# -*- compile-command: "manim /Users/van/Desktop/target/scene.py UnwriteReverseTrue -pqh"; -*-
from manim import *
# manim scene.py UnwriteReverseTrue -pqh
# manim scene.py UnwriteReverseTrue --format mov -qk -t
class UnwriteReverseTrue(Scene):
def construct(self):
# emacs = ImageMobject("Blackvariant-Button-Ui-Requests-6-Emacs.1024.png")
emacs = SVGMobject("GNU_Emacs-Logo.wine.svg", stroke_color="#6247a1")
emacs.height = 2
emacs.scale(0.4)
color = iter(["#42208c", "#6247a1", "white"])
for layer in emacs:
temp = next(color)
print(temp)
layer.set_color(temp)
if temp == "#6247a1":
print("sacle layer")
layer.scale(0.8)
self.add(emacs)
emacs.shift(LEFT * 4)
g = MarkupText(
'<b><span foreground="#d956ff" size="x-large" style="oblique">G</span></b>',
font="Optima",
)
self.add(g)
g.shift(LEFT * 3)
o = MarkupText(
'<b><span foreground="#fa9175" size="x-large" style="oblique">O</span></b>',
font="Optima",
)
self.add(o)
o.move_to(LEFT * 2.4)
left_l = MarkupText(
'<b><span foreground="#d956ff" size="x-large">L</span></b>',
font="Mshtakan",
)
self.add(left_l)
left_l.move_to(UP * 2 + LEFT * 1.8)
left_e = MarkupText(
'<b><span foreground="#d956ff" size="x-large">E</span></b>',
font="Mshtakan",
)
self.add(left_e)
left_e.move_to(UP * 2.5 + LEFT * 1.2)
m = MarkupText(
'<b><span foreground="#fe86fe" size="x-large">M</span></b>',
font="BM Hanna Air",
)
self.add(m)
m.move_to(UP * 3 + LEFT * 0.65)
g2 = MarkupText(
'<b><span foreground="#fa9175" size="x-large">G</span></b>', font="Mshtakan"
)
self.add(g2)
g2.move_to(RIGHT * 3)
e1 = MarkupText(
'<b><span foreground="#fa9175" size="x-large">E</span></b>', font="Mshtakan"
)
self.add(e1)
e1.move_to(RIGHT * 3.5)
e2 = MarkupText(
'<b><span foreground="#fa9175" size="x-large">E</span></b>', font="Mshtakan"
)
self.add(e1)
e2.move_to(RIGHT * 4)
k = MarkupText(
'<b><span foreground="#fe86fe" size="x-large">K</span></b>',
font="Gurmukhi MN",
)
self.add(k)
k.move_to(RIGHT * 4)
onTincidunt = MarkupText(
'<b><span foreground="#d956ff" size="large">ON TINCIDUNT</span></b>',
font="Optima",
)
self.add(onTincidunt)
onTincidunt.move_to(DOWN * 5, RIGHT * 4)
g2.shift(RIGHT * 1)
e1.shift(RIGHT * 2)
e2.shift(RIGHT * 3)
k.shift(RIGHT * 3)
# let font to init position
leftValueInit = 0.1
self.play(
Circumscribe(emacs, Circle, color="#0984e3", buff=-1, fade_out=True),
left_l.animate.move_to(LEFT * 1.8),
left_e.animate.move_to(LEFT * 1.2),
m.animate.move_to(LEFT * 0.6),
g2.animate.move_to(RIGHT * leftValueInit),
e1.animate.move_to(RIGHT * (leftValueInit + 0.6)),
e2.animate.move_to(RIGHT * (leftValueInit + 1.2)),
k.animate.move_to(RIGHT * (leftValueInit + 1.75)),
onTincidunt.animate.move_to(DOWN * 0.8 + RIGHT * 1.5),
lag_ratio=0.5,
run_time=3,
)
# right out
leftvalue = 1
self.play(
emacs.animate.move_to(RIGHT * 0.2),
g2.animate.move_to(RIGHT * leftvalue),
e1.animate.move_to(RIGHT * (leftvalue + 0.6)),
e2.animate.move_to(RIGHT * (leftvalue + 1.2)),
k.animate.move_to(RIGHT * (leftvalue + 1.75)),
lag_ratio=0.5,
run_time=0.4,
)
# right int
leftvalue = 0.4
self.play(
emacs.animate.move_to(DOWN * 0.2 + LEFT * 0.1).scale(0.25),
g2.animate.move_to(RIGHT * leftvalue),
e1.animate.move_to(RIGHT * (leftvalue + 0.6)),
e2.animate.move_to(RIGHT * (leftvalue + 1.2)),
k.animate.move_to(RIGHT * (leftvalue + 1.75)),
run_time=0.8,
)
self.wait(10)