Hi Saverio,
the attached script works for me to change the font size dynamically while
PyMOL is running. To increment the font size by 5 points, do:
PyMOL> run inc_fontsize.py
PyMOL> inc_fontsize 5
The script also binds CTRL-PageUp and CTRL-PageDown.
Cheers,
Thomas
import pymol
from pymol import cmd
tk_fontsize = 12
def inc_fontsize(d=1):
import tkFont
global tk_fontsize
tk_fontsize += int(d)
for name in ('TkTextFont', 'TkDefaultFont', 'TkFixedFont'):
font = tkFont.nametofont(name)
font.configure(size=tk_fontsize)
s = pymol._ext_gui.skin
s.text.configure(font=font)
s.entry.configure(font=font)
cmd.extend('inc_fontsize', inc_fontsize)
cmd.set_key('CTRL-pgup', inc_fontsize)
cmd.set_key('CTRL-pgdn', inc_fontsize, (-1,))
On 22 Apr 2015, at 12:27, s...@tiscali.it wrote:
>
> -------- Original Message --------
>
> Subject: Re: [PyMOL] Problem with How do I change the font in the Tck/Tk
> external GUI window?
> Date: Wed, 22 Apr 2015 18:21:56 +0200
> From: s...@tiscali.it
> To: Osvaldo Martin <aloctavo...@gmail.com>
> Thanks ,
> I have made the change in the file
> as root.
> But when I run pymol the font size
> of File Edit Build ..... and Reset Zoom
> and the PyMol> line edit it is unchanged.
>
> It is possibile to increase the size of the
> font of this labels?
>
> It is possibile to choose the size 11, 13 ..?
>
> Saverio
> Il 22.04.2015 17:47 Osvaldo Martin ha scritto:
>
> Hi Saverio,
>
> The file is the correct one.
>
> Inside the file
>
> ./python2.7/dist-packages/pmg_tk/PMGApp.py
>
> find the line
>
> def initializeTk_unix(self):
> pass
>
> and change it to make it look like
>
>
> def initializeTk_unix(self):
> self.root.option_add('*Font', 'Lucida 10')
> self.pad = ' '
>
> Best,
> Osvaldo
>
>
> On Wed, Apr 22, 2015 at 12:05 PM, <s...@tiscali.it> wrote:
> Hi,
> I have installed pymol on Ubuntu 14.10
> with sudo apt-get install pymol.
> Now I need to change the size of char in
> the gui menus.
> I have read the FAQ about this need.
>
> How do I change the font in the Tck/Tk external GUI window?
> • Open pymol/modules/pmg_tk/PMGApp.py in a text editor
> • Search for "my_fw_font". You'll find a section like this...
> if sys.platform[:5]=='linux':
> self.my_fw_font=('lucida console',7)
> elif sys.platform[:3]=='win':
> self.my_fw_font=('lucida console',8) # Courier 9
> else:
> self.my_fw_font=('lucida console',10)
>
> • Change the font size for your operating system.
>
> So I execute
> cd /usr/lib && find . -name "PMGApp.py"
> that gives me
> ./python2.7/dist-packages/pmg_tk/PMGApp.py
>
> then
> grep -c my_fw_font ./python2.7/dist-packages/pmg_tk/PMGApp.py
> gives me 0.
>
> So I try with
> cd /usr/lib && grep -nr my_fw_font .
> ./python2.7/dist-packages/pmg_tk/skins/normal/__init__.py:405:
> self.my_fw_font=(self.font,10)
> ./python2.7/dist-packages/pmg_tk/skins/normal/__init__.py:420:
> self.my_fw_font=(family,size)
> ./python2.7/dist-packages/pmg_tk/skins/normal/__init__.py:423:
> self.my_fw_font=(self.font,8)
> ./python2.7/dist-packages/pmg_tk/skins/normal/__init__.py:427:
> self.my_fw_font=(self.font,10)
> ./python2.7/dist-packages/pmg_tk/skins/normal/__init__.py:429:
> text.configure(font = self.my_fw_font)
> Il file binario ./python2.7/dist-packages/pmg_tk/skins/normal/__init__.pyc
> corrisponde
> Il file binario ./python2.7/dist-packages/pmg_tk/ColorEditor.pyc corrisponde
> ./python2.7/dist-packages/pmg_tk/ColorEditor.py:111:
> self.listbox.component('listbox').configure(font=app.my_fw_font)
>
> What file I must modify and with which code ?
> What with ./python2.7/dist-packages/pmg_tk/skins/normal/__init__.pyc?
>
> Thanks in advance ( expecially from my eyes )
>
> Saverio
--
Thomas Holder
PyMOL Principal Developer
Schrödinger, Inc.
------------------------------------------------------------------------------
BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT
Develop your own process in accordance with the BPMN 2 standard
Learn Process modeling best practices with Bonita BPM through live exercises
http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_
source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net