lilphil has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks

This question is probably very specific to wxPerl - unless I have overlooked something daft.
From what I can tell, the way to create a wxFont object is as follows:
my $font = Wx::Font->new(..)
however when I put that into practice, I get the error "Usage: Wx::Font::newNativeInfo(CLASS, info) at ./localetest.pl line 13."
What am I doing wrong?
#!/usr/bin/perl use warnings; use Wx qw(wxDEFAULT wxNORMAL wxFONTENCODING_DEFAULT); package TestApp; use base 'Wx::App'; sub OnInit { my $this = shift; my $font = Wx::Font->new( 14, wxDEFAULT, wxNORMAL, wxNORMAL, 0, "", wxFONTENCODING_DEFAULT); } package main; my $app = TestApp->new();

Replies are listed 'Best First'.
Re: using Wx::Font (wxPerl question)
by PodMaster (Abbot) on Dec 05, 2003 at 15:05 UTC
    update: you must alwaysuse strict;, always!!! The font constants aren't being exported to the correct namespace, so the correct constructor isn't called.

    What did you expect to get? I don't know the nitty gritty, but basically if you're going to be using fonts, you need to have some windows, see the hello.pl wxPerl sample

    MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
    I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
    ** The third rule of perl club is a statement of fact: pod is sexy.

      Thanks PodMaster

      Now I feel silly.
      So kids, when strict complains that barewords arnt allowed while "strict subs" - you dont just turn off strict.
      *hides*