473,408 Members | 1,980 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

Writing a Python font viewer/manager

Hello.
On Windows, I used to have a little app that would let me navigate visually
through my 20,000+ fonts and I could create groups of them for quick
install/remove from the system. It was great to be able to type in a word
(say for a logo) and then see it in all the fonts.

I would like to write something similar for Linux (and maybe it'll work on
others) in Python.

I am not really a pro - this would be my first significant Python attempt
and I was wondering if anyone had any pointers.

I have looked at the demos for WxPython - it looks quite good. It crashed
badly on an example where you can drag playing cards around. I tried to
drag the font (or the text) and it hung, not a good sign!

I see that KDE has a way to see ttf files - is there a way to get at that
control via PyQT?

Is an HTML control of some kind the way to go?

It should be able to list hundreds of font samples and allow one to scroll
through them. Being able to 'select' a font by clicking the visual would
also be good.

Any thoughts would be great.
--
Bats
~..~
(I can only post on weekends and rare times during the week.)

Jul 18 '05 #1
5 1859
Bats wrote:
Hello.
On Windows, I used to have a little app that would let me navigate
visually through my 20,000+ fonts and I could create groups of them for
quick install/remove from the system. It was great to be able to type in a
word (say for a logo) and then see it in all the fonts.


Perhaps take a look at gfontview - not python app, but may show you how to
access fonts.

--
Maciej "Fiedzia" Dziardziel (fiedzia (at) fiedzia (dot) prv (dot) pl)
www.fiedzia.prv.pl
Jul 18 '05 #2
The code below works in windows. I assume it works in linux also.

The code illustrates how to create a "font-picker". If you want
something more advanced, you could roll up your sleeves and create
your own. It wouldn't be too bad. Check out wx.FontEnumerator.
wx.FontEnumerator will enumerate the fonts on your system (duhhh...)

import wx

app = wx.PySimpleApp()
dlg = wx.FontDialog(None, wx.FontData())
if dlg.ShowModal() == wx.ID_OK:
fontdata = dlg.GetFontData()
font = fontdata.GetChosenFont()
wx.MessageBox("You chose the `%s' font." % font.GetFaceName())
else:
wx.MessageBox("You pressed cancel and didn't choose any fonts.")

app.MainLoop()

HTH,
jw

On Thu, 28 Oct 2004 23:14:53 +0200, Maciej Dziardziel
<fi*****@fiedzia.prv.pl> wrote:
Bats wrote:
Hello.
On Windows, I used to have a little app that would let me navigate
visually through my 20,000+ fonts and I could create groups of them for
quick install/remove from the system. It was great to be able to type in a
word (say for a logo) and then see it in all the fonts.


Perhaps take a look at gfontview - not python app, but may show you how to
access fonts.

--
Maciej "Fiedzia" Dziardziel (fiedzia (at) fiedzia (dot) prv (dot) pl)
www.fiedzia.prv.pl
--
http://mail.python.org/mailman/listinfo/python-list

Jul 18 '05 #3
Jaime Wyant had this to say:
The code below works in windows. I assume it works in linux also.

The code illustrates how to create a "font-picker". If you want
something more advanced, you could roll up your sleeves and create
your own. It wouldn't be too bad. Check out wx.FontEnumerator.
wx.FontEnumerator will enumerate the fonts on your system (duhhh...)

Thanks for that code. I am still new to wx and guis via Python.
The area that actually displays the font - is that a 'control' or something
I can directly work with? Maybe it can be made longer, have a scroll-bar
and show multiple lines of differing fonts - something like that?

Any QT suggestions?
--
Bats
~..~
(I can only post on weekends and rare times during the week.)

Jul 18 '05 #4
Maciej Dziardziel had this to say:
Perhaps take a look at gfontview - not python app, but may show you how to
access fonts.

Thanks - I will look at it. Would like to do my own anyway, but it'll be
interesting ;)

--
Bats
~..~
(I can only post on weekends and rare times during the week.)

Jul 18 '05 #5
Well, I feel a little stupid - I just found /usr/share/docs/PyQt-examples/
and in there I found some font examples - at least I have something to hang
my hacking on now.

Cheers.
--
Bats
~..~
(I can only post on weekends and rare times during the week.)

Jul 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

13
by: Allison Bailey | last post by:
Hi Folks, I'm a brand new Python programmer, so please point me in the right direction if this is not the best forum for this question.... I would like to open an existing MS Excel spreadsheet...
0
by: Emile van Sebille | last post by:
QOTW: "Have you ever used the copy module? I am *not* a beginner, and have used it *once* (and I can't remember what for, either)." -- Michael Hudson "It will likely take a little practice...
4
by: Ron Provost | last post by:
Hello, I'm using python 2.4.2 on Win XP Pro. I'm trying to understand a behavior I'm seeing in some Tkinter code I have. I've reduced my question to a small piece of code: #####BEGIN CODE...
10
by: Sylvain Audet | last post by:
Hello! We have a Windows application that is using Crystal Reports reports containing Barcode fonts. Those reports are called through reflection into a Crystal Report Viewer and we need to have...
3
by: Chubbly Geezer | last post by:
I'm using a particular font (for credit card symbols) within a crystal report which looks fine when I preview, however when I run the report with real data, the font is now shown correctly. It...
6
by: Joel Hedlund | last post by:
Hi! I've been thinking about writing a good multiple sequence alignment (MSA) viewer in python. Sort of like ClustalX, only with better zoom and pan tools. I've been using python in my work for...
37
by: shapper | last post by:
Hello, I have been reading a lot about fonts and I got to the following conclusions: 1.Use % do define font size 2. Avoid defining font in Body and P tags 3. Avoid using Verdana I...
0
by: makys | last post by:
Hi, I have the same problem, now. Please, if you resolve your problem, send me as. I get only empty alert box without. next message. My OracleService is shut down and needs to be restarted too....
0
by: Linda Liu[MSFT] | last post by:
Hi Al, Based on my understanding, you have an application which prints something to printers. The problem is that the font of "OCR A Extended" cannot be printed properly on some of printers. If...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.