STEM 隨筆︰古典力學︰模擬術【可視化】 E

Web Widget,中文可譯作:小部件小工具微件掛件等,是一小塊可以在任意一個基於 HTML 的網頁上執行代碼構成的小部件,它的表現形式可能是影片地圖新聞小遊戲等等。它的根本思想來源於代碼復用,在一般的情況下,Widget 的代碼形式包含了 DHTMLJavaScript 及 Adobe Flash

概要

Web Widget 可以向一個基於 HTML 的 Web 頁面上添加一些動態內容。它可能是瀏覽量計數器,實時股票資訊以及航班資訊等等 。通常情況下,一個 Widget 的功能都是由第三方提供的代碼實現的,而 Web 開發者,只需要將這些代碼塊嵌入自己的頁面即可。其實,在全球資訊網發展的早期,Web 開發者就已經嘗試在他們的頁面中嵌入一些第三方開發的代碼塊,不過這些代碼塊早期的功能通常都是一些諸如連結計數,或者英語:廣告橫幅等。

Web Widget 可以被視作是小型的可下載應用程式,不過這些應用程式都是運用一些 Web 技術來得以實現的,可能包括JavaScriptHTML 及 CSS 等。Web Widget 通常都需要依賴一些公開的 Web API。這些 API 可能是由瀏覽器公布,或者是由一些Widget引擎公布。

作用以及批評

Web Widget 允許 Web 開發者在他們的頁面中整合任何第三方Web 站點所提供的 Widget 代碼,以便於在自己的網站中聚合各種各樣的資訊與資源。這樣一來,原先網頁瀏覽者可能必須要去好幾個不同站點才能取得到的資訊可以在一次頁面存取中全部取得到[1]

基於 Web Widget 的特性,一些人認為,通過這一途徑,站點的擁有者可以藉助 Widget 提升自己站點的用戶體驗,而行銷人員也可藉助 Widget 在用戶不需要跳轉當前頁面的情況下也可以推廣廠商自身的品牌與服務[2];但與此相反,另外一些人卻認為 Web Widget 所帶來的只是又一個商業上的泡沫而已,因為當用戶在一個整合了多種 Web Widget 的個性化站點或者社群網站中(如 Facebook ) 尋找樂趣時,他們是不太可能記住 Widget 中推廣的品牌與產品的[3]

另外,由於任何 Widget 代碼都可以被嵌入到 Web 頁面中,因此一些帶有惡意代碼的 Widget 將可能給頁面瀏覽者帶來麻煩。比如 Facebook 上曾經有一個名為「Secret Crush」的 Widget ,它會誘導用戶去自動下載廣告軟體[4]。2

─── 維基百科《Web Widget》詞條

 

其實 PyDy viz 建基

/three.js

JavaScript 3D library. https://threejs.org/

three.js

JavaScript 3D library

The aim of the project is to create an easy to use, lightweight, 3D library. The library provides <canvas>, <svg>, CSS3D and WebGL renderers.

ExamplesDocumentationWikiMigratingQuestionsForumGitterSlack

───

以及

ipywidgets: Interactive HTML Widgets

ipywidgets are interactive HTML widgets for Jupyter notebooks and the IPython kernel.

Notebooks come alive when interactive widgets are used. Users gain control of their data and can visualize changes in the data.

Learning becomes an immersive, plus fun, experience. Researchers can easily see how changing inputs to a model impact the results. We hope you will add ipywidgets to your notebooks, and we’re here to help you get started.

Core Interactive Widgets

A demonstration notebook provides an overview of the core interactive widgets, including:

  • sliders
  • progress bars
  • text boxes
  • toggle buttons and checkboxes
  • display areas
  • and more

Jupyter Interactive Widgets as a Framework

Besides the widgets already provided with the library, the framework can be extended with custom widget libraries.

A template project is available in the form of a cookie cutter here.

This project is meant to help custom widget authors get started with the packaging and the distribution of Jupyter interactive widgets.

It produces a project for a Jupyter interactive widget library following the current best practices for using interactive widgets. An implementation for a placeholder “Hello World” widget is provided.

Popular widget libraries such as bqplot, pythreejs and ipyleaflet

follow exactly the same template and directory structure. They can serve as more advanced examples of usage of the Jupyter widget infrastructure.

For detailed information, please refer to the ipywidgets documentation.

 

之上。何況 ipywidgets 也有

/pythreejs

A Jupyter – Three.js bridge

pythreejs

A Python / ThreeJS bridge utilizing the Jupyter widget infrastructure.

Screencast

 

橋樑,熟悉之後,非但表現空間可以擴大,亦可深入 PyDy 可視化之認識也!

更別說附帶好處不止如此呦☆

Interactive Widgets

Jupyter widgets enable interactive data visualization in the Jupyter notebooks.

icon to represent multiple notebooks

Notebook Widgets

Notebooks come alive when interactive widgets are used. Users can visualize and control changes in the data. Learning becomes an immersive, plus fun, experience. Researchers can easily see how changing inputs to a model impacts the results.