473,770 Members | 1,677 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1873
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.FontEnumerat or.
wx.FontEnumerat or will enumerate the fonts on your system (duhhh...)

import wx

app = wx.PySimpleApp( )
dlg = wx.FontDialog(N one, wx.FontData())
if dlg.ShowModal() == wx.ID_OK:
fontdata = dlg.GetFontData ()
font = fontdata.GetCho senFont()
wx.MessageBox(" You chose the `%s' font." % font.GetFaceNam e())
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*****@fiedzi a.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.FontEnumerat or.
wx.FontEnumerat or 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
35561
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 and extract information from specific worksheets and cells. I'm not really sure how to get started with this process. I ran the COM Makepy utility from my PythonWin (IDE from ActiveSTate),
0
1893
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 before this stuff rattles off your fingertips easily." -- Paul Rubin BJ MacNevin wants to run python from a CD. http://groups.google.com/groups?threadm=BhVyb.389117$Tr4.1144562@attbi_s03
4
2687
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 ################# import Tkinter as Tk
10
8315
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 the Barcode fonts to be self-installed at runtime whenever a report is viewed. I tried the following steps: Public Shared Sub InstallFonts()
3
1493
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 seems to revert back to a standard font and displays letters instead of card symbols. Any ideas.? Can I embed a font or include one in my VB app.? Thanks
6
1259
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 a couple of years, but this is my first shot at making a GUI so I'd very much appreciate some ideas from you people to get me going in the right direction. Despite my GUI n00b-ness I need to get it good and usable with an intuitive look and feel.
37
2269
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 understand the reason of point 1.
0
1008
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. Thank you for reply, Peter Makys Originally posted by Tommy Hansen Tommy Hansen
0
1393
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 I'm off base, please feel free to let me know. I performed a test printing the font of "OCR A Extended" to a printer in my office but didn't reproduce the problem on my side. The font was printed properly in my test. The model of the printer I...
0
9595
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9432
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10232
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10059
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7420
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6682
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3974
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2822
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.