nntp2http.com
Posting
Suche
Optionen
Hilfe & Kontakt

Tkinter - TagCloud - Höhe?, Breite?

Von: Thomas Lehmann (iris-und-thomas-lehmann@t-online.de) [Profil]
Datum: 26.09.2009 11:21
Message-ID: <3079e969-009e-47e3-8aec-af4e5c46c3de@l34g2000vba.googlegroups.com>
Newsgroup: de.comp.lang.python
Hallo,

Der nachfolgende Code erzeugt eine TagCloud (noch ohne links). Was ich
nun gerne erreichen würde ist, daß das Text widget soviel Platz
benutzt, wie es wirklich braucht. Wenn ich nun eine Breite eingestellt
habe möchte ich die Höhe so justieren, daß der Text möglichst genau
hineinpasst. Umgekehrt, wenn ich die Höhe eingestellt habe möchte ich
in der Lage sein die Breite so zu justieren....

Könnte da bitte jemand helfen?

Danke
Thomas


APPENDIX:

import Tkinter as tk

root = tk.Tk()
root.title("Tag Cloud")

text = tk.Text(root)
text["wrap"] = "word"
text.pack(expand = tk.YES, fill = tk.BOTH)

data = [ (8,"Commercial"), (14, "Freeware"), (10, "Editor"),
(8,
"IDE"),\
(12, "Versioning"), (8, "FileManager"), (12, "Tool"),\
(7, "Backup"), (14, "Portable"), (8, "Linux"), (16,
"Windows"),\
(10, "Image"), (13, "Sound")]

for (fontSize, tag) in data:
text.tag_configure("font%d" % (fontSize), font=("Arial",
fontSize))
text.insert(tk.END, tag, "font%d" % (fontSize))
text.insert(tk.END, " ")

root.mainloop()

[ Auf dieses Posting antworten ]