<commit_before>-- Example of an drawing graphics onto a canvas.
import Prelude 
import Gtk

main = do
  initGUI
  dia <- dialogNew
  dialogAddButton dia stockButtonOk responseOk
  contain <- dialogGetUpper dia
  canvas <- drawingAreaNew
  canvas `onSizeRequest` return (Requisition 40 40)
  canvas `onExpose` updateCanvas canvas
  boxPackStartDefaults contain canvas
  widgetShow canvas
  dialogRun dia

updateCanvas :: DrawingArea -> Event -> IO Bool
updateCanvas canvas (Expose { area=rect }) = do
  win <- drawingAreaGetDrawWindow canvas
  (width,height) <- drawingAreaGetSize canvas
  gc <- gcNew win
  gcSetValues gc $ newGCValues {
    foreground = Color 65535 0 0,
    capStyle = CapRound,
    lineWidth  = 20,
    joinStyle = JoinRound
  }
  drawLines win gc [(30,30),(width-30,height-30),(width-30,30),(30,height-30)]<commit_msg>[project @ 2003-01-11 02:42:50 by juhp] 2003-01-11  <NAME>  <<EMAIL>><commit_after>-- Example of an drawing graphics onto a canvas.
import Prelude 
import Gtk

main = do
  initGUI
  dia <- dialogNew
  dialogAddButton dia stockButtonOk ResponseOk
  contain <- dialogGetUpper dia
  canvas <- drawingAreaNew
  canvas `onSizeRequest` return (Requisition 40 40)
  canvas `onExpose` updateCanvas canvas
  boxPackStartDefaults contain canvas
  widgetShow canvas
  dialogRun dia

updateCanvas :: DrawingArea -> Event -> IO Bool
updateCanvas canvas (Expose { area=rect }) = do
  win <- drawingAreaGetDrawWindow canvas
  (width,height) <- drawingAreaGetSize canvas
  gc <- gcNew win
  gcSetValues gc $ newGCValues {
    foreground = Color 65535 0 0,
    capStyle = CapRound,
    lineWidth  = 20,
    joinStyle = JoinRound
  }
  drawLines win gc [(30,30),(width-30,height-30),(width-30,30),(30,height-30)]
{'fraction_non_alphanumeric': 0.09064665127020785, 'fraction_numerical': 0.046189376443418015, 'mean_word_length': 3.9656160458452723, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1168829', 'n_tokens_mistral': 621, 'n_tokens_neox': 536, 'n_words': 168}