guile-pstk

A Tk interface for Guile (A fork of (and hopefully a future merge?) https://github.com/kikyTokamuro/guile-pstk/).
Log | Files | Refs | README | LICENSE

canvas.scm (878B)


      1 ; PS/Tk Example Program "Canvas"
      2 ; Copyright (C) 2022 Daniil Archangelsky aka Kiky Tokamuro
      3 ; See the PS/Tk license for conditions of use.
      4 
      5 (add-to-load-path
      6  (string-append
      7   (dirname (current-filename))
      8   "/../"))
      9 
     10 (use-modules (pstk))
     11 
     12 (tk-start)
     13 
     14 (tk/wm 'title tk "Canvas")
     15 (tk/wm 'resizable tk 0 0)
     16 
     17 (let* ((canvas (tk 'create-widget 'canvas
     18 		   'background: "#ffffff"
     19 		   'width: 300
     20 		   'height: 200)))
     21   (canvas 'create 'rect 30 10 120 80
     22 	  'outline: "#fb0"
     23 	  'fill: "#fb0")
     24   (canvas 'create 'oval 110 30 210 80
     25 	  'outline: "#000"
     26 	  'fill: "#000")
     27   (canvas 'create 'arc 30 200 90 100
     28 	  'start: 0
     29 	  'extent: 210
     30 	  'outline: "#ab1"
     31 	  'fill: "#ab1")
     32   (canvas 'create 'text 190 150
     33 	  'font: "Hack 20"
     34 	  'fill: "#30bc22"
     35 	  'text: "guile-pstk")
     36   (canvas 'create 'line 50 100 500 100
     37 	  'fill: "#2f55ff"
     38 	  'width: 5)  
     39   (tk/pack canvas)
     40   (tk-event-loop))
     41