can-lehmann / owlkettle

A declarative user interface framework based on GTK 4
https://can-lehmann.github.io/owlkettle/README
MIT License
367 stars 14 forks source link

how to draw circles #104

Closed tissatussa closed 8 months ago

tissatussa commented 8 months ago

I see many widgets but it's unclear to me how to draw circels .. is it even possible ?

I discovered the Cairo Path widget in /examples/misc and i'm able to compile it. It's a nice example how to draw lines and change parameters with several options - the source code is good for learning !

I guess drawing circles can also be done with Cairo, but i have no clue .. maybe some GTK examples exist which can be ported to Nim / Owlkettle ?

can-lehmann commented 8 months ago

I reccomend looking at the cairo.nim file for a list of all supported cairo procs. For your case: https://github.com/can-lehmann/owlkettle/blob/main/owlkettle/cairo.nim#L168

tissatussa commented 8 months ago

@can-lehmann thanks, for me this .nim file is an abstract but i'll study it : indeed i see proc circle*(ctx: CairoContext, x, y, r: float).

I just found https://github.com/Elteoremadebeethoven/pycairo-tutorial and thus also https://zetcode.com/gfx/pycairo/ : i guess i'll start with Cairo in Python and learn how to work with the functions and their arguments .. then i'll switch to Owlkettle circle, assuming it's about the same GTK properties etc.