Title: Add globals and callback handling by tychedelia · Pull Request #120 · processing/libprocessing · GitHub
Open Graph Title: Add globals and callback handling by tychedelia · Pull Request #120 · processing/libprocessing
X Title: Add globals and callback handling by tychedelia · Pull Request #120 · processing/libprocessing
Description: In Processing, globals and callbacks like width, height, mousePressed, etc. are members of the containing PApplet that the user's sketch runs in. This means that inside the user's draw function, the user can simply write width due to the elision of the this receiver in Java. Further, the draw loop can delegate callbacks to overrides on the user's PApplet. In Python, this is problematic. For stylistic reasons, we do not want to have draw/setup require accepting a self receiver, as this would require writing self.width etc. anywhere the user wishes to access some Processing state. As such, in Python, we instead do a bit of magic in order make some global variables provide the same semantics as Processing. This PR provides the following related changes to help support this: Adds a pattern around global variable updates to avoid overwriting user variables that may shadow our variable's names. Support for importing our main module as an alias, i.e. import mewnala as mn where mn.width delegates to the underlying getter via __getattr__. Callback functionality, where we introspect the global ns for a user's function. Input support to enable knowing when to fire callbacks. Misc surface methods for retrieving surface state. A new monitor API object. We don't support monitor selection fully yet but will in the future. Cleanup for ipython/jupyter hooks to make sure the above work.
Open Graph Description: In Processing, globals and callbacks like width, height, mousePressed, etc. are members of the containing PApplet that the user's sketch runs in. This means that inside the user's draw func...
X Description: In Processing, globals and callbacks like width, height, mousePressed, etc. are members of the containing PApplet that the user's sketch runs in. This means that inside the user's d...
Opengraph URL: https://github.com/processing/libprocessing/pull/120
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:1165ae72-5619-8075-7660-3edab824a7ba |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E4C6:1C8839:6A4C80:92F659:6A61874B |
| html-safe-nonce | f24053cc1e7f446eca432e6ee40b369efecb12101f28a868d9cc44dd54d37f18 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNEM2OjFDODgzOTo2QTRDODA6OTJGNjU5OjZBNjE4NzRCIiwidmlzaXRvcl9pZCI6IjY2MjAxOTg3MDg0OTU2MTU4MTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a3871e415501796d8c8208900643c0da674f3aab8a12917334047f1228b0181d |
| hovercard-subject-tag | pull_request:3560636780 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/processing/libprocessing/pull/120/files |
| twitter:image | https://avatars.githubusercontent.com/u/10366310?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/10366310?s=400&v=4 |
| og:image:alt | In Processing, globals and callbacks like width, height, mousePressed, etc. are members of the containing PApplet that the user's sketch runs in. This means that inside the user's draw func... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | c28c2f6607f2aacbd934868d997038895c9780d08babfe918550d73773326f4c |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/processing/libprocessing git https://github.com/processing/libprocessing.git |
| octolytics-dimension-user_id | 1617169 |
| octolytics-dimension-user_login | processing |
| octolytics-dimension-repository_id | 1101329545 |
| octolytics-dimension-repository_nwo | processing/libprocessing |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 1101329545 |
| octolytics-dimension-repository_network_root_nwo | processing/libprocessing |
| turbo-body-classes | logged-out env-production page-responsive full-width |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | cd05235d52ffb3318513d883a56c87a121015c8b |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width