Tiny_Python試用録(8)
%681:「https://github.com/LonamiWebs/Animake」(3)
`▼
--------------------------------------------------------------------------------
(0)【[%671]】の続きなので,まず「(1)①」を見てください
(1)参考資料
①【[%671]】@
「https://www.blogger.com/blog/post/edit/6859150935899261916/2463065428668505071」
②「__init__.py」@
「https://github.com/LonamiWebs/Animake/blob/master/scenes/__init__.py」
③「example.py」@「https://github.com/LonamiWebs/Animake/blob/master/scenes/example.py」
④「README.md」@
「https://github.com/LonamiWebs/Animake/commit/d1beda854786939bc822b609fe7c16af3a2ce33f」
・Better README showing a more concrete example
⑤「anistate.py」@
「https://github.com/LonamiWebs/Animake/blob/master/anistat」
・Add a poly function to the AniState
⑥「gui.py」@
「https://github.com/LonamiWebs/Animake/blob/master/gui.py」
・ Support a .start() method on the scene modules
⑦「.gitignore」@
「https://github.com/LonamiWebs/Animake/commit/d73368f0b042fa271387f6eb45ea75d78b8e0fe4」
・Introduce the concept of scenes
・「https://github.com/LonamiWebs/Animake/tree/master/scenes」
(3)「https://github.com/LonamiWebs/Animake/commits?author=Lonami」
の紹介
`▼
-------------------------------------------------------------
・Support a .start() method on the scene modules.
・the scene will be restarted. To stop the scene earlier,
you should `raise StopIteration` (which will restart it).
・You can also set the duration to `None` or `0` to represent infinite.
-------------------------------------------------------------
`▲/*〔「`□`」の用法は?〕*/
(4)「README.md」/*「(1)④」*/の紹介
Based on [@expectocode's captivox](https://github.com/expectocode/captivox),
but modified to only provide a thin wrapper for rendering animations and
exporting the result to a video file.
`▼
------------------------------------------------
```python
def callback(ani):
pass # Use the input 'AniState' at will
```
------------------------------------------------
`▲/*〔「```」の用法は?〕*/
(5)「__init__.py」/*「(1)②」*/は参照不能でした.
(6)「example.py」/*「(1)③」*/も参照不能でした.
(7)「gui.py」/*「(1)⑥」*/の単純コピー
------------------------------------------------
#!/usr/bin/env python3
import importlib
import os
import sys
import warnings
from PyQt5.QtCore import (
self.setPalette(pal)
self.setAutoFillBackground(True)
self.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding)
self.frame_no = 1
self.frame_no = 0
self.callback = lambda a: None
def minimumSizeHint(self):
return QSize(50, 50)
).exec()
def paintEvent(self, *args):
ani = AniState(self, self.frame_no)
(ani.size(5)
.color((0, 0, 255, 64)).line(0, 0, ani.width, ani.height)
.color((0, 255, 0, 64)).line(0, ani.height, ani.width, 0)
.size(ani.frame)
.color((255, 0, 0, 64)).point(ani.width / 2, ani.height / 2))
self.callback(AniState(self, self.frame_no))
class Animake(QWidget):
self.canvas.timer.start(int((1000 + FPS - 1) / FPS))
def main():
def main(args):
app = QApplication([])
win = Animake()
if args:
mod = args[0]
if not mod.startswith('scenes.'):
mod = 'scenes.' + mod
else:
mod = 'scenes.example'
win.canvas.callback = importlib.import_module(mod).callback
win.show()
return app.exec()
if __name__ == '__main__':
- main()
+ main(sys.argv[1:])
------------------------------------------------
(8)GitHubの資料参照関連サイト
①「https://docs.github.com/en/github/site-policy/github-acceptable-use-policies」
②「https://docs.github.com/en」
(9)Grey lines are ready to delete. Let me know using comment field of this file.
・If deletion is delayed, send me a mail to「bonsai.juku@gmail.com」
--------------------------------------------------------------------------------
`▲「(5)-(6)」は公開禁止(?)
%687:【[%711]】に関するメモ
`▼
--------------------------------------------------------------------------------
(0)「Python7(1).docx」の基本仕様を呈示.
①原稿は等幅の「courier」で記述.
②原稿の文字「`」,「_」の背景色を灰色にする.
③制御文字の背景色をマゼンタにする.
他の文字は適宜,灰色,マゼンタ以外に着色.
④数値は10進数で表示する.
⑤行頭の「`_ 」は「\n 」の略記. /*〔改行の直後に半角スペース4個 〕*/
⑥行末の「`+_」は次行の文字列との結合.
⑦行番号(オプション)は行頭から49文字目に「#」を置いて
3桁の行番号と1桁のレベルを付加.
⑧解釈実行前にすべての「`」,「_」を無色の半角スペースで置換.
(1)参考資料
①
②
③
(2)例1/*【[%E3](2)】*/
\n-------------------------------------------------#100.0
\n_number = int(number) #101.1
\n #102.1
\n`if_ number % 3 == 0 `:_ #103.1
\n print('Fizz') #104.2
\n`if_ number % 5 == 0 `:_ #105.1
\n print('Buzz') #106.2
\n`if_ number % 15 == 0 `:_ #107.1
\n print('FizzBuzz') #110.2
\n`else:_ #111.1
\n print(number) #112.2
\n-------------------------------------------------#113.1
・「#」の位置を「Python8」に配慮して「49文字目」に変更
/*〔行番号・行頭レベルを8進数で表示〕*/
(3)「(2)」の原稿(無色)は
\n-------------------------------------------------#100.0
\n_number = int(number) #101.1
\n #102.1
\n`if_ number % 3 == 0 `:_ #103.1
\n print('Fizz') #104.2
\n`if_ number % 5 == 0 `:_ #105.1
\n print('Buzz') #106.2
\n`if_ number % 15 == 0 `:_ #107.1
\n print('FizzBuzz') #110.2
\nelse: #111.1
\n print(number) #112.2
\n-------------------------------------------------#113.1
(2)【[%662]⑧】のデリミタ「`{_□`}_」,「`(_□`)_」,「`[_□`]_」,「`,_」を用いて着色すると構文が分かり易くなる.
・リスト:a = `[_10,_ 20,_ 30,_ 40`]_
・タプル:a = `(_10,_ 20,_ 30,_ 40`)_
・辞書 :d = `{_'Yamada':_ 30,_ 'Suzuki':_ 40,_ 'Tanaka':_ 80`}_
・出典 :「http://www.tohoho-web.com/python/list.html#list」
-------------------------------------------------------------------------------
`▲
%688:【[%811]】に関するメモ
`▼
--------------------------------------------------------------------------------
(0)「Python8(1).docx」の基本仕様を呈示.
①10進数「□」を8進数に変換して,これを「&□」で明示.
/*〔【[%687](3)の「#013.1」は「#&13.1」と表示〕*/
②どの行も「&77字」以下.
③どのモジュールも「&77行」以下.
④どのパッケージも「&7モジュール」以下.
(1)参考資料
①
②
③
(2)原則として【[%711]】に準拠.
・どのモジュールも500行以下
・どのパッケージも4000行以下
(3)原則として「Python9(1).docx」の基本仕様は「Python8」に準拠.
・最終目標は「Learning Galois Theory with Python.pdf」
・Draft is in【[%32]】of「OCNマイポケットのファイル★」
★https://www.blogger.com/blog/post/edit/6859150935899261916/4202198499080205759
-------------------------------------------------------------
`▲
689:EOF(@L38)/*〔体調不良のため,I would like to stop submission.〕*/
コメント
コメントを投稿