user-interface - 如何在 Racket GUI 工具包中的框架上添加图像?

标签 user-interface racket

如何将图像(例如 png)添加到frame% 对象上?

#lang racket
(define my-frame (new frame%))
;want to add an image to my-frame

最佳答案

使用a canvas .

(define my-frame (new frame%
                      [label "Example"]
                      [width 300]
                      [height 300]))

(new canvas% 
     [parent my-frame]
     [paint-callback
      (λ (canvas dc)
        (send dc draw-bitmap (read-bitmap "/path/to/image.png") 0 0))])

(send my-frame show #t)

关于user-interface - 如何在 Racket GUI 工具包中的框架上添加图像?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68380048/

相关文章:

user-interface - Canvas 或 SVG UI 组件

c# - WPF DataGridColumn 不接受 0

scheme - 你如何在 Scheme 中返回一个过程的描述?

scheme - 直接引用自己的匿名 lambda

scheme - 从方案中的列表中打印对

macros - Racket 宏不起作用

ios - 如何防止用户输入密码时文本移动?

python - 是否有用于自定义自动完成的 Python 库?

jquery - 从一个链接显示具有相同 ID 的两个 div 的内容

lisp - SICP 练习 1.37 : My iterative solution got the right answer but got wrong in 1. 38