Drawing onto canvas% element -


i have problem while trying draw onto canvas gui element.

i create frame, canvas , try draw on dc context of canvas draw-line method, nothing happens. frame canvas shown, line isn't shown on canvas.

(require racket/gui/base)  (define frame (new frame% [label "frame"] [width 500] [height 500])) (define canvas (new canvas% [parent frame])) (define dc (send canvas get-dc))  (send dc draw-line 10 10 200 200) (send frame show #t) 

does know wrong in code above ?

try this:

(require racket/gui/base)  (define frame (new frame% [label "frame"] [width 500] [height 500])) (define canvas (new canvas% [parent frame])) (define dc (send canvas get-dc))  (send frame show #t) (sleep/yield 1) (send dc draw-line 10 10 200 200) 

it seems need show frame first , wait bit let window ready.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -