On Sun, Sep 14, 2008 at 1:30 AM, sa6113 <[EMAIL PROTECTED]> wrote:
>
> Thanks for your help, it works, but it is very difficult because I want to
> show a FontDialog contains all fonts in system to user and change the plot
> text (Legend, Label and ex.) font to that.
> How may I accomplish that? Is there any way?

I am not sure precisely what difficulty you are having, but if you are
trying to change the font family for *subsequent* figures after the
user has made their font choice in the dialog, then the rc setting
will work fine.  If you are trying to change an existing figure, then
rc will not help, but findobj will.  findobj recursive searches a
figure for all the objects in contains, and you can filter for object
type.  So you could do something like

import matplotlib.text as text

for t in fig.findobj(text.Text):
    t.set_family(somefamily)

or t.set_fontproperty(someprop), etc...

If you want to keep the font property (size, weight) as is and only
change the file name, the following may work for some cases

  prop = t.get_font_properties()
  prop.set_file(fname)

but this is fairly dangerous (because you could be mixing a monoface
style with a non monospace font family for example) so it is not
recommended.

JDH

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to