This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html
Set by lizmat on 8 June 2022.
00:58 notna joined 01:13 notna left 01:14 notna joined 01:16 notna left 01:26 notna joined 02:04 notna left
winfredraj hello all 08:31
im trying to run an example from the Gnome::Gtk for drawing Area and am not able to get it running 08:34
<script src="gist.github.com/winfredraj/463aede...script> 08:36
===SORRY!=== Error while compiling /home/winfred/Code/Raku/Gnome/drawing_area.raku Invalid typename 'cairo_t' in parameter declaration. at /home/winfred/Code/Raku/Gnome/drawing_area.raku:7 ------> cairo_t⏏ $cr-no, Gnome::Gtk3::DrawingArea :_widg 08:37
I have tried Gnome::Cairo::cairo_t as well 08:38
Can anyone help me here please? 08:40
librasteve lemme jump on my pc… 5 mins 08:50
winfredraj thanks librasteve 08:54
Happy Easter everyone! 08:55
librasteve ok - i have coffee - lets take a look 09:00
gist.github.com/winfredraj/463aede...98708c8a70 09:01
brew install gtk+3 09:06
meantime - don't you need a comma after cairo_t?
seems like the gist has some awkward line continuations - possibly with extra spaces? 09:11
winfredraj cdn.discordapp.com/attachments/768...2d1f0& 09:33
cairo_t seems to be the type of $cr-no 09:34
librasteve think I have GTK installed (phew!) 09:36
please can you point me to the original example?
winfredraj hold on 09:37
martimm.github.io/gnome-gtk3/conte....html#wow9
librasteve thanks!
winfredraj I think here a colon is missing before _widget in the method callback type signature 09:38
I got another basic example working and I found it surprising snappy. I was expecting a very slow and laggy experience. It was a small window creation but I like what I could do a lot just with Raku code 09:40
this would help me move over to Raku a lot more when I need GUI, right now I have to spin WPF with F# backends to get some basic GUI 09:41
09:41 habere-et-disper joined
habere-et-disper m: say 3 (elem) [3,5] 09:41
camelia True
habere-et-disper m: say 4 (elem) <4 5>
camelia False
habere-et-disper Is this expected because we have sets of Int and sets of IntStr ? 09:43
I was expecting True for 09:44
m: say 4 (elem) <4 5>
camelia False
winfredraj m: say 4 (elem)(4,5) 09:45
Raku eval True
librasteve @winfredraj - please try cairo_bool_t instead github.com/MARTIMM/gnome-native/bl...es.rakumod 09:46
winfredraj you mean cairo_bool_t $cr-no? 09:47
librasteve yep 09:48
(or maybe just delete the type)
winfredraj I tried deleting the type already 09:49
librasteve plus I guess you know that π character was butchered by the gist
winfredraj Unknown type Any used in native call. If you want to pass a struct, be sure to use the CStruct or CPPStruct representation. If you want to pass an array, be sure to use the CArray type.
librasteve ah - ok 09:50
winfredraj using cairo_bool_t makes the errors go away, but I dont have any window popping up either 09:51
with my Gnome::Cairo $cr .= new(:native-object($cr-no))
librasteve well a different error is progress of a sort
winfredraj $cr-no is used as a parameter for :native-object 09:52
cdn.discordapp.com/attachments/768...d987a&
and native-object seems to have the type N-GObject 09:53
so this cairo_t or whatever type we use should match N-GObject at the end of the day
librasteve @winfredraj - I am getting "kit" errors now on my mac ... 10:02
Cannot locate native library 'libgtk-3.so.0': dlopen(libgtk blah, blah 10:03
winfredraj In Linux we need to install libgtk-3-dev
librasteve yeah - well brew has its limitations! 10:04
tbh I am a bit out of my depth on the Gtk specific stuff - my best advice is to raise an issue over on the repo and see if you get any help from there ... github.com/MARTIMM/gnome-gtk3/issues 10:05
ab5tract habere-et-disper: that is indeed a Int vs IntStr thing. because the types are different (or differ-Int ;), the (elem) call doesn't find the LHS 10:10
m: dd set <4 5>, 4
camelia Set.new(4,IntStr.new(4, "4"),IntStr.new(5, "5"))
ab5tract winfredraj: how complicated is your GUI going to be? I ask because I've always found GTK::Simple to be much easier to use 10:15
habere-et-disper Thanks ab5tract -- Happy 🐣 10:16
ab5tract But if you need direct access to Cairo, martin's more comprehensive work is the only way to fly
winfredraj Thanks librasteve
@ab5tract - initially I need it for basic stuff, but if I am really going to do what I am planning to do, then I will need a comprehensive framework like WPF 10:18
ab5tract got it
winfredraj so I wont have a lot of choice there
thanks ab5tract, let me see if I can figure something out 10:20
ab5tract from your gist I don't see a gui/window set up. maybe using an instance of Gnome::Gtk3::Main (martimm.github.io/gnome-gtk3/conte...Main.html) will work as your :native-object argument? 10:25
habere-et-disper: Thanks! and right back at you\ 10:26
11:03 teatwo joined 11:06 teatime left
librasteve m: say <4> (elem) <4 5> 11:14
Raku eval True
librasteve dd <4> 11:15
m: dd <4>
Raku eval IntStr.new(4, "4")
librasteve fwiw Set operations like (elem) use .WHICH to test sameness - so they are picky and look at value-types 11:16
m: say 4.WHICH
Raku eval Int|4
librasteve m: say <4>.WHICH
Raku eval IntStr|Int|4|Str|4
habere-et-disper Thank you @librasteve :) 11:35
Why can I narrow a Num to an Int, but not an IntStr to an Int ?
m: say (3.0).narrow.WHICH
camelia Int|3
habere-et-disper m: say (<3>).narrow.WHICH
camelia IntStr|Int|3|Str|3
lizmat "Returns the number converted to the narrowest type that can hold it without loss of precision" 11:36
I guess can be interpreted as needing an IntStr to be converted to an Int
habere-et-disper My internal working model of raku's magic is that more spicy magic is available behind quote words < > and ~~ and was surprised my dish needed more jalapeños. 11:45
12:01 habere-et-disper left
lizmat habere-et-disper: I think it's just an oversight 12:05
16:19 habere-et-disper joined
habere-et-disper Should True and False be included with raku localization ? 16:20
github.com/Raku/L10N/tree/main/localizations
And what about "temp" ? 16:22
lizmat habere-et-disper: please make an issue for that 17:04
habere-et-disper (y) 17:05
lizmat regarding True and False: handling enums in general is going to be tricky
perhaps an exception can be made for True / False and probably Less / Same / More 17:06
19:09 habere-et-disper left
winfredraj @librasteve and @ab5tract - got the Gtk example working! had to use Gnome::Cairo::Types to use cairo_t 19:46
that naturally only solved the error but to see it in action, I had to hook it up to a window and a grid like ab5tract had suggested 19:47
cdn.discordapp.com/attachments/768...32539&
thanks !!
ab5tract Great!
20:59 teatwo left 21:00 teatwo joined 23:35 kjp left 23:38 kjp joined