fork download
  1. import sys, os
  2. from tkinter import tix
  3. import tkinter as tk
  4. import tkinter.font as font
  5.  
  6. rt = tk.Tk()
  7. rt.title('main')
  8. fw = tix.Tk()
  9. fw.title('fonts')
  10. fw.geometry('1536x768')
  11. sw = tix.ScrolledWindow(fw, scrollbar=tk.BOTH)
  12. sw.pack(fill=tk.BOTH, expand=1)
  13. rows, cols = 64, 8
  14. fam = font.families()
  15. for i, nam in enumerate(fam):
  16. e = tk.Label(sw.window, text=nam, font=(nam, 8, 'normal', 'roman'),
  17. background='white', anchor=tk.W)
  18. e.grid(row=i//cols, column=i%cols, sticky=tk.N+tk.S+tk.W+tk.E)
  19. rt.mainloop()
Runtime error #stdin #stdout #stderr 0.04s 76224KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "./prog.py", line 6, in <module>
  File "/usr/lib/python3.5/tkinter/__init__.py", line 1880, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: no display name and no $DISPLAY environment variable