If I may suggest something. Instead of using 1 and 2, use bool variable (and meaningful name :))
As to tkinter&pyglet code not working on Linux, but working on Windows - I suspect it's just one of those OS dependent quirks, not problem with your code per se...
If you insist on using tkinter, why not install the font, instead of trying to load it from file without installation? In this case no pyglet will be needed at all
import pyglet import time use_colon = True pyglet.font.add_file('digital-7.ttf') window = pyglet.window.Window() window.set_fullscreen(True) label = pyglet.text.Label('', font_name='Digital-7', font_size=400, x=window.width//2, y=window.height//2, anchor_x='center', anchor_y='center') def update_clock(dt): global use_colon label.text = time.strftime("%H:%M %P" if use_colon else "%H.%M %P") use_colon = not use_colon pyglet.clock.schedule_interval(update_clock, 1) @window.event def on_draw(): window.clear() label.draw() pyglet.app.run()however using global variables is bad, so a better solution is to define a class and work with it
import pyglet import time class DigitalClock: def __init__(self, window): self.use_colon = True self.label = pyglet.text.Label('', font_name='Digital-7', font_size=400, x=window.width//2, y=window.height//2, anchor_x='center', anchor_y='center') def update(self): self.label.text = time.strftime("%H:%M %P" if self.use_colon else "%H.%M %P") self.use_colon = not self.use_colon def update_clock(dt, digital_clock): digital_clock.update() pyglet.font.add_file('digital-7.ttf') window = pyglet.window.Window() window.set_fullscreen(True) digital_clock = DigitalClock(window) pyglet.clock.schedule_interval(update_clock, 1, digital_clock=digital_clock) @window.event def on_draw(): window.clear() digital_clock.label.draw() pyglet.app.run()This is very basic example. the class can be customized at instantiation (font, size, etc.)
As to tkinter&pyglet code not working on Linux, but working on Windows - I suspect it's just one of those OS dependent quirks, not problem with your code per se...
If you insist on using tkinter, why not install the font, instead of trying to load it from file without installation? In this case no pyglet will be needed at all
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs