{"id":20299853,"url":"https://github.com/python-ninja-hebi/pyscript-puzzles","last_synced_at":"2026-04-20T04:37:09.957Z","repository":{"id":178032480,"uuid":"520156366","full_name":"Python-Ninja-Hebi/pyscript-puzzles","owner":"Python-Ninja-Hebi","description":"Some small programs with pyscript","archived":false,"fork":false,"pushed_at":"2023-01-29T14:54:15.000Z","size":361,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-04T06:24:43.862Z","etag":null,"topics":["html","javascript","pyscript","python"],"latest_commit_sha":null,"homepage":"","language":"HTML","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Python-Ninja-Hebi.png","metadata":{"files":{"readme":"README.ipynb","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-01T15:04:17.000Z","updated_at":"2022-08-01T15:07:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"4f2b7ddc-19f6-4ec8-96a3-d1795ae9924c","html_url":"https://github.com/Python-Ninja-Hebi/pyscript-puzzles","commit_stats":null,"previous_names":["python-ninja-hebi/pyscript-puzzles"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Python-Ninja-Hebi/pyscript-puzzles","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Python-Ninja-Hebi%2Fpyscript-puzzles","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Python-Ninja-Hebi%2Fpyscript-puzzles/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Python-Ninja-Hebi%2Fpyscript-puzzles/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Python-Ninja-Hebi%2Fpyscript-puzzles/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Python-Ninja-Hebi","download_url":"https://codeload.github.com/Python-Ninja-Hebi/pyscript-puzzles/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Python-Ninja-Hebi%2Fpyscript-puzzles/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32032852,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T00:18:06.643Z","status":"online","status_checked_at":"2026-04-20T02:00:06.527Z","response_time":94,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["html","javascript","pyscript","python"],"created_at":"2024-11-14T16:16:32.335Z","updated_at":"2026-04-20T04:37:09.924Z","avatar_url":"https://github.com/Python-Ninja-Hebi.png","language":"HTML","funding_links":[],"categories":[],"sub_categories":[],"readme":"{\n \"cells\": [\n  {\n   \"cell_type\": \"markdown\",\n   \"id\": \"2f29d06e-aa35-446e-b8b8-e0c65f641d5f\",\n   \"metadata\": {},\n   \"source\": [\n    \"# pyscript puzzle\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"id\": \"9f64b26e-aa65-4c95-b418-79d91c2153bd\",\n   \"metadata\": {},\n   \"source\": [\n    \"Some small programs with pyscript (https://pyscript.net)\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"id\": \"3bfc9411-255a-49a1-81fb-75eaa77f8d50\",\n   \"metadata\": {},\n   \"source\": [\n    \"## #2\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"id\": \"4ea978bc-e7d0-4f1a-8f14-a16f67eb256a\",\n   \"metadata\": {},\n   \"source\": [\n    \"Sometimes you need a nice formated **table** in **PyScript**.\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"id\": \"0e068dc7-fa75-4eb0-ba35-f970f2bca9f4\",\n   \"metadata\": {},\n   \"source\": [\n    \"**Task:**\\n\",\n    \"\\n\",\n    \"Make a table with Bootstrap.js.\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"id\": \"add1d664-fb32-48a7-9b34-289120c34d8c\",\n   \"metadata\": {},\n   \"source\": [\n    \"\u003cimg src=\\\"img/puzzle2.png\\\" width=\\\"400\\\" align=\\\"left\\\"\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"id\": \"4d84bdad-a077-41aa-8f67-31933563e53c\",\n   \"metadata\": {},\n   \"source\": [\n    \"**Solution**\\n\",\n    \"\\n\",\n    \"You can use **Bootstrap** in Python like you do in JavaScript.\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"id\": \"3b9427b8-1621-415d-938a-a249ca6c7999\",\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"\u003chtml\u003e\\n\",\n    \"    \u003chead\u003e\\n\",\n    \"        \u003clink rel=\\\"stylesheet\\\" href=\\\"https://pyscript.net/latest/pyscript.css\\\" /\u003e\\n\",\n    \"        \u003cscript defer src=\\\"https://pyscript.net/latest/pyscript.js\\\"\u003e\u003c/script\u003e\\n\",\n    \"        \u003clink href=\\\"https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css\\\" rel=\\\"stylesheet\\\" crossorigin=\\\"anonymous\\\"\u003e\\n\",\n    \"    \u003c/head\u003e\\n\",\n    \"    \u003cbody\u003e\\n\",\n    \"        \u003cpy-title\u003epuzzle #4 bootstrap table \u003c/py-title\u003e\\n\",\n    \"        \u003ctable class=\\\"table table-light\\\"\u003e\\n\",\n    \"            \u003cthead\u003e\\n\",\n    \"                \u003ctr\u003e\\n\",\n    \"                    \u003cth scope=\\\"col\\\"\u003eName\u003c/th\u003e\\n\",\n    \"                    \u003cth scope=\\\"col\\\"\u003edescription\u003c/th\u003e\\n\",\n    \"                \u003c/tr\u003e\\n\",\n    \"            \u003c/thead\u003e\\n\",\n    \"            \u003ctbody id=\\\"content\\\"\u003e\\n\",\n    \"            \u003c/tbody\u003e\\n\",\n    \"        \u003c/table\u003e\\n\",\n    \"\\n\",\n    \"    \u003cpy-script\u003e\\n\",\n    \"import js\\n\",\n    \"import inspect\\n\",\n    \"\\n\",\n    \"table = js.document.getElementById('content')\\n\",\n    \"\\n\",\n    \"for i in inspect.getmembers(js):\\n\",\n    \"    row = js.document.createElement('tr')\\n\",\n    \"    object_name = js.document.createElement('td')\\n\",\n    \"    description = js.document.createElement('td')\\n\",\n    \"\\n\",\n    \"    object_name.innerText = i[0]\\n\",\n    \"    description.innerText = str(i[1])\\n\",\n    \"\\n\",\n    \"    row.append(object_name)\\n\",\n    \"    row.append(description)\\n\",\n    \"\\n\",\n    \"    table.appendChild(row)\\n\",\n    \"        \u003c/py-script\u003e\\n\",\n    \"    \u003c/body\u003e\\n\",\n    \"\u003c/html\u003e\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"id\": \"d110134e-43ed-4c48-bdcb-e148a6b36320\",\n   \"metadata\": {},\n   \"source\": [\n    \"## #1\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"id\": \"66736628-c2cd-4641-9fc3-1a19d2d73612\",\n   \"metadata\": {},\n   \"source\": [\n    \"In **PyScript** you can use **JavaScript programm objects** with the Python module **js**.\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"id\": \"c5e14fab-8c38-4e6c-81ee-29fcd418aff7\",\n   \"metadata\": {},\n   \"source\": [\n    \"**Task:**\\n\",\n    \"\\n\",\n    \"List all JavaScript programm objects with python.\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"id\": \"8c5a0050-1164-46f7-830a-89867f477994\",\n   \"metadata\": {},\n   \"source\": [\n    \"\u003cimg src=\\\"img/puzzle1.png\\\" width=\\\"400\\\" align=\\\"left\\\"\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\u003cbr\u003e\"\n   ]\n  },\n  {\n   \"cell_type\": \"markdown\",\n   \"id\": \"bdc0905c-0342-458a-9b1e-4b914bb1276e\",\n   \"metadata\": {},\n   \"source\": [\n    \"**Solution**\\n\",\n    \"\\n\",\n    \"Use Python module **inspect**. It works also with JavaScript.\"\n   ]\n  },\n  {\n   \"cell_type\": \"code\",\n   \"execution_count\": null,\n   \"id\": \"9741f583-2ab6-405b-a39b-cd1b74618b89\",\n   \"metadata\": {},\n   \"outputs\": [],\n   \"source\": [\n    \"\u003chtml\u003e\\n\",\n    \"    \u003chead\u003e\\n\",\n    \"        \u003clink rel=\\\"stylesheet\\\" href=\\\"https://pyscript.net/latest/pyscript.css\\\" /\u003e\\n\",\n    \"        \u003cscript defer src=\\\"https://pyscript.net/latest/pyscript.js\\\"\u003e\u003c/script\u003e\\n\",\n    \"    \u003c/head\u003e\\n\",\n    \"    \u003cbody\u003e\\n\",\n    \"        \u003cpy-title\u003epuzzle #1 Inspect js\u003c/py-title\u003e\\n\",\n    \"        \u003cdiv id=\\\"content\\\"\u003e\u003cdiv\u003e\\n\",\n    \"\\n\",\n    \"        \u003cpy-script\u003e     \\n\",\n    \"import js\\n\",\n    \"import inspect\\n\",\n    \"\\n\",\n    \"for i in inspect.getmembers(js):\\n\",\n    \"    PyScript.write('content',f'\u003cp\u003e{i[0]} {i[1]}\u003c/p\u003e', append=True)\\n\",\n    \"        \u003c/py-script\u003e\\n\",\n    \"    \u003c/body\u003e\\n\",\n    \"\u003c/html\u003e\"\n   ]\n  }\n ],\n \"metadata\": {\n  \"kernelspec\": {\n   \"display_name\": \"Python 3 (ipykernel)\",\n   \"language\": \"python\",\n   \"name\": \"python3\"\n  },\n  \"language_info\": {\n   \"codemirror_mode\": {\n    \"name\": \"ipython\",\n    \"version\": 3\n   },\n   \"file_extension\": \".py\",\n   \"mimetype\": \"text/x-python\",\n   \"name\": \"python\",\n   \"nbconvert_exporter\": \"python\",\n   \"pygments_lexer\": \"ipython3\",\n   \"version\": \"3.9.12\"\n  }\n },\n \"nbformat\": 4,\n \"nbformat_minor\": 5\n}\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-ninja-hebi%2Fpyscript-puzzles","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpython-ninja-hebi%2Fpyscript-puzzles","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpython-ninja-hebi%2Fpyscript-puzzles/lists"}