Skip to content

Instantly share code, notes, and snippets.

View mjvesa's full-sized avatar

Matti Vesa mjvesa

View GitHub Profile
@mjvesa
mjvesa / vaadin_with_python.md
Created September 25, 2019 19:26
Article about writing Vaadin apps in Python

Python and Vaadin 14

In this article we will see how Vaadin UIs can be written using Python. We'll use Jython which implies Python 2.7. GraalVM will be considered in a later article.

Wiggling Python into Vaadin

First download a server side starter from vaadin.com or any other place. We won't be using client side templates, but build UIs purely using code. Next

@mjvesa
mjvesa / button_example_widget.scm
Created April 8, 2016 11:14
Example of the newer define-widget form for defining Vaadin widgets
;; Example of a custom Vaadin widget in Scheme using Spil (github.com/mjvesa/spil)
;;
;; define-widget is a macro which takes the code and distributes it between the client and server
;; client part is uploaded to the browser
;; call-server invokes a server-rpc from the client side
;; server-rpc defines a server-rpc
(define-widget (button text listener)
`((client
(let ((button (element-new '(button ,text))))
(append-to-root button)
;; Example of a custom Vaadin widget in Scheme using Spil (github.com/mjvesa/spil)
;;
;; The widget macro is wrapped in another macro to set the button text and callback listener
;; client part is uploaded to the browser
;; call-server invokes a server-rpc from the client side
;; server-rpc defines a server-rpc
(define-macro (button text listener)
`(widget
(client
(let ((button (element-new '(button ,text))))