Tkinter Qs 
Author Message
 Tkinter Qs

question 1:
what form of measurement does Tkinter use? Pixels or DIB?

question 2:
why doesnt this work? (text not being colored)

t = Text(frame, width=50, height=15)
t.tag_config("test", foreground="red")
t.insert(END, "test")

* have looked into Tkinter documentation and am using examples directly
as-is, textbox is bein drawna nd text is present but color not being

thanks in advance,


Thu, 27 Nov 2003 01:07:03 GMT  
 Tkinter Qs

>what form of measurement does Tkinter use? Pixels or DIB?

Sometimes it uses pixels, sometimes it uses lines, and sometimes
it uses characters.

b=Button(root,text="Test",width=10) # 10 characters wide
t=Text(root,width=20,height=2) # 20 characters wide, 2 lines high
f=Frame(root,width=25,height=35,bg="green") # 25 by 35 dots

This is often maddening.

Fredrik Lundh mentions a way of working around this odd use of
multiple units of measure at (wrapped for line length):

That's from his excellent An Introduction to Tkinter. I recommend
it highly.

>why doesnt this work? (text not being colored)
>t = Text(frame, width=50, height=15)
>t.tag_config("test", foreground="red")
>t.insert(END, "test")

The first argument to tag_config() is a user-defined tag name. The tag
needs to be added to specific characters or character ranges:

t=Text(root, width=50, height=15)
t.tag_config("mytag", foreground="red")
t.insert(END, "test")

You can also specify the tag name when you're inserting text:

>>> t.insert(END,"wibble","mytag")


Thu, 27 Nov 2003 01:40:10 GMT  
 [ 2 post ] 

 Relevant Pages 

1. Extensions/tkinter/* vs Modules/tkinter* (was: Python 1.1 w/ tkinter for AIX)

2. several Qs

3. Qs on CLUBMGR, Template BUG ???

4. Qs

5. Qs about language nomenclature

6. New newbies Qs on Ruby

7. Newbie Qs: startup time, Module.constants, chdir, Ruby distro's library

8. Qs on Ruby and DbC/Smalltalk

9. 2 Qs: IndexedFaceSets & browsers

10. Qs re 'Write & 'Read

11. newbie obj files Qs

12. NASM Qs


Powered by phpBB® Forum Software