Re: Tutorial
Chris Angelico <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Message-ID | <CAPTjJmoWEaof3G_LOj0077Rc2swyFYiCh6oEVWU=EAaqxQ1Vsg@mail.gmail.com> |
On Thu, Dec 8, 2016 at 10:16 PM, Arie van Wingerden <[email protected]> wrote: > Hi, > > I just wish to explore Pike as a Python alternative. > > But the second small program in the tutorial already fails: > Running this: > > int main() > { > GTK.setup_gtk(); > GTK.Alert("Hello world!", "Title"); > return -1; > } > > Gives this result: > > E:/src/pike/test.pike:4:Index 'Alert' not present in module GTK. > E:/src/pike/test.pike:4:Indexed module was: GTK. > E:/src/pike/test.pike:4:Too many arguments to `() (function call) (expected > 0 arguments). > E:/src/pike/test.pike:4:Got : string(32..119). > Pike: Failed to compile script. > > On OSDir I found that maybe I should install GTK separately. Also in the > docs I see references to GTK1 and GTK2. > > Q1: Which GTK version is appropriate for Windows? > > Q2: is there a Pike package manager for this kind of thing? Oh... yeah, sorry about that. The GTK tutorial is way out of date. It's been on my TODO list for ages, but that doesn't really help much. Here's a GTK2 hello-world: int main() { GTK2.setup_gtk(); GTK2.MessageDialog(0, 0, GTK2.BUTTONS_OK, "Hello, world!")->show(); return -1; } Yes, it's not as short as the GTK.Alert form, but MessageDialog does a lot more. If you want more of a language-level Hello World, try this: int main() { write("Hello, world!\n"); } Check out my GitHub repositories for some cool stuff you can do with Pike. https://github.com/Rosuav I use it for back-end work (although you won't see all of that there, as my biggest projects aren't public), GUI applications (Gypsum, StilleBot, Zawinski), data processing scripts, file management tools, and all manner of one-shot scripts. Pike stands alongside Python in my toolbox of easy and convenient languages. If you want to get into GTK work, definitely use GTK2 (Pike doesn't have GTK3 bindings as yet, and GTK1 isn't worth hanging onto), but on Windows, that means you have to choose between the latest Pike with a slightly older GTK, and the latest GTK on a slightly older Pike. I recommend the former, until such time as you run into a problem. Have fun learning Pike! It's a great language. ChrisA