Python Forum
Load external font and does not show font in the window
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Load external font and does not show font in the window
#8
Ummm... I was trying for clock here the code:
import pyglet
from pyglet import clock
from time import strftime

pyglet.font.add_file('/home/pi/.fonts/digital-7.ttf')
window = pyglet.window.Window()
window.set_fullscreen(False)

while True:
    time_now=strftime('%H:%M:%S %P')
    label = pyglet.text.Label(time_now,
                            font_name='Digital-7',
                            font_size=300,
                            x=window.width//2, y=window.height//2,
                            anchor_x='center', anchor_y='center')

@window.event
def on_draw():
    window.clear()
    label.draw()

pyglet.app.run()
Can do that?
Reply


Messages In This Thread
RE: Load external font and does not show font in the window - by ATARI_LIVE - Sep-15-2020, 10:46 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Python code for alignment and font size 1418 0 431 Jan-14-2024, 03:56 AM
Last Post: 1418
  Is there a way to call and focus any popup window outside of the main window app? Valjean 6 2,291 Oct-02-2023, 04:11 PM
Last Post: deanhystad
  Change font in a list or tuple apffal 4 2,875 Jun-16-2023, 02:55 AM
Last Post: schriftartenio
  can openpyxl read font colors mperemsky 3 1,989 May-09-2023, 11:18 AM
Last Post: MindKeeper
  Comparing two columns with same value but different font format doug2019 1 823 Jan-08-2023, 02:58 PM
Last Post: Larz60+
  PIL Image im.show() no show! Pedroski55 2 1,084 Sep-12-2022, 10:19 PM
Last Post: Pedroski55
  Pyspark Window: perform sum over a window with specific conditions Shena76 0 1,310 Jun-13-2022, 08:59 AM
Last Post: Shena76
  Folium: Conflict with Font Awesome Kit jgomes_eu 0 1,301 Apr-23-2022, 03:18 PM
Last Post: jgomes_eu
  Print text with big font and style tomtom 5 14,795 Mar-03-2022, 01:29 AM
Last Post: tomtom
  PIL Image im.show() no show! Pedroski55 6 5,446 Feb-08-2022, 06:32 AM
Last Post: Pedroski55

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020