René's URL Explorer Experiment


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

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:1165ae72-5619-8075-7660-3edab824a7ba
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idE4C6:1C8839:6A4C80:92F659:6A61874B
html-safe-noncef24053cc1e7f446eca432e6ee40b369efecb12101f28a868d9cc44dd54d37f18
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNEM2OjFDODgzOTo2QTRDODA6OTJGNjU5OjZBNjE4NzRCIiwidmlzaXRvcl9pZCI6IjY2MjAxOTg3MDg0OTU2MTU4MTkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmaca3871e415501796d8c8208900643c0da674f3aab8a12917334047f1228b0181d
hovercard-subject-tagpull_request:3560636780
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/processing/libprocessing/pull/120/files
twitter:imagehttps://avatars.githubusercontent.com/u/10366310?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/10366310?s=400&v=4
og:image:altIn 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_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Nonec28c2f6607f2aacbd934868d997038895c9780d08babfe918550d73773326f4c
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/processing/libprocessing git https://github.com/processing/libprocessing.git
octolytics-dimension-user_id1617169
octolytics-dimension-user_loginprocessing
octolytics-dimension-repository_id1101329545
octolytics-dimension-repository_nwoprocessing/libprocessing
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id1101329545
octolytics-dimension-repository_network_root_nwoprocessing/libprocessing
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasecd05235d52ffb3318513d883a56c87a121015c8b
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/processing/libprocessing/pull/120/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fprocessing%2Flibprocessing%2Fpull%2F120%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
Code QualityEnforce quality at mergehttps://github.com/features/code-quality
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fprocessing%2Flibprocessing%2Fpull%2F120%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=processing%2Flibprocessing
Reloadhttps://github.com/processing/libprocessing/pull/120/files
Reloadhttps://github.com/processing/libprocessing/pull/120/files
Reloadhttps://github.com/processing/libprocessing/pull/120/files
Please reload this pagehttps://github.com/processing/libprocessing/pull/120/files
processing https://github.com/processing
libprocessinghttps://github.com/processing/libprocessing
Notifications https://github.com/login?return_to=%2Fprocessing%2Flibprocessing
Fork 12 https://github.com/login?return_to=%2Fprocessing%2Flibprocessing
Star 56 https://github.com/login?return_to=%2Fprocessing%2Flibprocessing
Code https://github.com/processing/libprocessing
Issues 68 https://github.com/processing/libprocessing/issues
Pull requests 3 https://github.com/processing/libprocessing/pulls
Actions https://github.com/processing/libprocessing/actions
Projects https://github.com/processing/libprocessing/projects
Wiki https://github.com/processing/libprocessing/wiki
Security and quality 0 https://github.com/processing/libprocessing/security
Insights https://github.com/processing/libprocessing/pulse
Code https://github.com/processing/libprocessing
Issues https://github.com/processing/libprocessing/issues
Pull requests https://github.com/processing/libprocessing/pulls
Actions https://github.com/processing/libprocessing/actions
Projects https://github.com/processing/libprocessing/projects
Wiki https://github.com/processing/libprocessing/wiki
Security and quality https://github.com/processing/libprocessing/security
Insights https://github.com/processing/libprocessing/pulse
Sign up for GitHub https://github.com/signup?return_to=%2Fprocessing%2Flibprocessing%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fprocessing%2Flibprocessing%2Fissues%2Fnew%2Fchoose
catilachttps://github.com/catilac
processing:mainhttps://github.com/processing/libprocessing/tree/main
tychedelia:globals-cbshttps://github.com/tychedelia/libprocessing/tree/globals-cbs
Conversation 4 https://github.com/processing/libprocessing/pull/120
Commits 1 https://github.com/processing/libprocessing/pull/120/commits
Checks 4 https://github.com/processing/libprocessing/pull/120/checks
Files changed https://github.com/processing/libprocessing/pull/120/files
Please reload this pagehttps://github.com/processing/libprocessing/pull/120/files
Add globals and callback handling https://github.com/processing/libprocessing/pull/120/files#top
Show all changes 1 commit https://github.com/processing/libprocessing/pull/120/files
dfab6e0 Add globals and callback handling. tychedelia Apr 21, 2026 https://github.com/processing/libprocessing/pull/120/commits/dfab6e0dc8d5fe200ee46fdde23edb40ecc534c6
Clear filters https://github.com/processing/libprocessing/pull/120/files
Please reload this pagehttps://github.com/processing/libprocessing/pull/120/files
Please reload this pagehttps://github.com/processing/libprocessing/pull/120/files
lib.rs https://github.com/processing/libprocessing/pull/120/files#diff-09eba0285bcbbd6969e1536a84c286b24672576258df6c26b755a00509bbbad9
state.rs https://github.com/processing/libprocessing/pull/120/files#diff-911fc10be90fd528e5834e8dde5b7648c03b00693380dbaf09fc30b1b3bd10ac
__init__.py https://github.com/processing/libprocessing/pull/120/files#diff-553e3b7f246cb301692df0317417d0910ec9a8ce08e36c499b8ad9dcd43cb778
graphics.rs https://github.com/processing/libprocessing/pull/120/files#diff-5e646152af1601f4260e98e1ca6b71ba58553e0507e4d0ebc4eb72bbe2bd27a2
input.rs https://github.com/processing/libprocessing/pull/120/files#diff-00678f2a0d04dd7517e55f1bead99cf6c23322ea3e6da54f05d85f01a9f13f6a
lib.rs https://github.com/processing/libprocessing/pull/120/files#diff-1ec2585043fa3ad733b06c34ed1af0c9938bdca17c75f4066e5e8fadecfc540c
monitor.rs https://github.com/processing/libprocessing/pull/120/files#diff-9c1a97c1f5c70a0c650f9fe2953a13253cbbd8ef8b7a864f362563c93fba3a5a
ipython_post_execute.py https://github.com/processing/libprocessing/pull/120/files#diff-72a5b84d3943c8ab6e4b0997d9ae0f77c404cddb7531e625e7bbc16cc62b5997
jupyter_post_execute.py https://github.com/processing/libprocessing/pull/120/files#diff-44ae40b497ac06a0b41faf1760675c77123791c69f75ba29718b9a1dbab98414
register_inputhook.py https://github.com/processing/libprocessing/pull/120/files#diff-5d559e98c28dc4f925ff99064bb69d4f583574e62dd21f24ee3a022ab2f17fee
surface.rs https://github.com/processing/libprocessing/pull/120/files#diff-537c8e2f60e13e6097206bee32b250dfa931799cd8197b9b4765019ea5c67712
time.rs https://github.com/processing/libprocessing/pull/120/files#diff-1fc8330b21f43a724112ed0d97e48f026a04d331a681b6c75907a3b2a70c5966
lib.rs https://github.com/processing/libprocessing/pull/120/files#diff-3a676e70510cf46e1ceca32379dff6cb444fc4c05c436b673adc97312aa9e2f4
monitor.rs https://github.com/processing/libprocessing/pull/120/files#diff-479653f53ca96bbe490f50dcb246b9ad5895387e17b5c1d1a1fc511bbd6f23c0
surface.rs https://github.com/processing/libprocessing/pull/120/files#diff-da93b94f99113fe7d78abe16cd9f4c9668c404b428166af572634fb4436a5763
time.rs https://github.com/processing/libprocessing/pull/120/files#diff-48a49cd004b5c864a880e5183c4d31c3128e459af47e4f89f206f55146368e41
crates/processing_input/src/lib.rshttps://github.com/processing/libprocessing/pull/120/files#diff-09eba0285bcbbd6969e1536a84c286b24672576258df6c26b755a00509bbbad9
View file https://github.com/tychedelia/libprocessing/blob/dfab6e0dc8d5fe200ee46fdde23edb40ecc534c6/crates/processing_input/src/lib.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/processing/libprocessing/pull/120/{{ revealButtonHref }}
https://github.com/processing/libprocessing/pull/120/files#diff-09eba0285bcbbd6969e1536a84c286b24672576258df6c26b755a00509bbbad9
crates/processing_input/src/state.rshttps://github.com/processing/libprocessing/pull/120/files#diff-911fc10be90fd528e5834e8dde5b7648c03b00693380dbaf09fc30b1b3bd10ac
View file https://github.com/tychedelia/libprocessing/blob/dfab6e0dc8d5fe200ee46fdde23edb40ecc534c6/crates/processing_input/src/state.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/processing/libprocessing/pull/120/{{ revealButtonHref }}
https://github.com/processing/libprocessing/pull/120/files#diff-911fc10be90fd528e5834e8dde5b7648c03b00693380dbaf09fc30b1b3bd10ac
https://github.com/processing/libprocessing/pull/120/files#diff-911fc10be90fd528e5834e8dde5b7648c03b00693380dbaf09fc30b1b3bd10ac
https://github.com/processing/libprocessing/pull/120/files#diff-911fc10be90fd528e5834e8dde5b7648c03b00693380dbaf09fc30b1b3bd10ac
crates/processing_pyo3/mewnala/__init__.pyhttps://github.com/processing/libprocessing/pull/120/files#diff-553e3b7f246cb301692df0317417d0910ec9a8ce08e36c499b8ad9dcd43cb778
View file https://github.com/tychedelia/libprocessing/blob/dfab6e0dc8d5fe200ee46fdde23edb40ecc534c6/crates/processing_pyo3/mewnala/__init__.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/processing/libprocessing/pull/120/{{ revealButtonHref }}
https://github.com/processing/libprocessing/pull/120/files#diff-553e3b7f246cb301692df0317417d0910ec9a8ce08e36c499b8ad9dcd43cb778
Please reload this pagehttps://github.com/processing/libprocessing/pull/120/files
crates/processing_pyo3/src/graphics.rshttps://github.com/processing/libprocessing/pull/120/files#diff-5e646152af1601f4260e98e1ca6b71ba58553e0507e4d0ebc4eb72bbe2bd27a2
View file https://github.com/tychedelia/libprocessing/blob/dfab6e0dc8d5fe200ee46fdde23edb40ecc534c6/crates/processing_pyo3/src/graphics.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/processing/libprocessing/pull/120/{{ revealButtonHref }}
https://github.com/processing/libprocessing/pull/120/files#diff-5e646152af1601f4260e98e1ca6b71ba58553e0507e4d0ebc4eb72bbe2bd27a2
https://github.com/processing/libprocessing/pull/120/files#diff-5e646152af1601f4260e98e1ca6b71ba58553e0507e4d0ebc4eb72bbe2bd27a2
https://github.com/processing/libprocessing/pull/120/files#diff-5e646152af1601f4260e98e1ca6b71ba58553e0507e4d0ebc4eb72bbe2bd27a2
https://github.com/processing/libprocessing/pull/120/files#diff-5e646152af1601f4260e98e1ca6b71ba58553e0507e4d0ebc4eb72bbe2bd27a2
https://github.com/processing/libprocessing/pull/120/files#diff-5e646152af1601f4260e98e1ca6b71ba58553e0507e4d0ebc4eb72bbe2bd27a2
https://github.com/processing/libprocessing/pull/120/files#diff-5e646152af1601f4260e98e1ca6b71ba58553e0507e4d0ebc4eb72bbe2bd27a2
https://github.com/processing/libprocessing/pull/120/files#diff-5e646152af1601f4260e98e1ca6b71ba58553e0507e4d0ebc4eb72bbe2bd27a2
https://github.com/processing/libprocessing/pull/120/files#diff-5e646152af1601f4260e98e1ca6b71ba58553e0507e4d0ebc4eb72bbe2bd27a2
crates/processing_pyo3/src/input.rshttps://github.com/processing/libprocessing/pull/120/files#diff-00678f2a0d04dd7517e55f1bead99cf6c23322ea3e6da54f05d85f01a9f13f6a
View file https://github.com/tychedelia/libprocessing/blob/dfab6e0dc8d5fe200ee46fdde23edb40ecc534c6/crates/processing_pyo3/src/input.rs
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/processing/libprocessing/pull/120/{{ revealButtonHref }}
https://github.com/processing/libprocessing/pull/120/files#diff-00678f2a0d04dd7517e55f1bead99cf6c23322ea3e6da54f05d85f01a9f13f6a
https://github.com/processing/libprocessing/pull/120/files#diff-00678f2a0d04dd7517e55f1bead99cf6c23322ea3e6da54f05d85f01a9f13f6a
Please reload this pagehttps://github.com/processing/libprocessing/pull/120/files
Please reload this pagehttps://github.com/processing/libprocessing/pull/120/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.