Python Forum
[Tkinter] Tkinter Font Color
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] Tkinter Font Color
#6
this here is amost exactly what i need. now i cant figure out how to prevent it from making new text entry boxes. i would just like it to update the variable im trying to print but not create a new line/text box every time. if i run this code in a loop it keeps creating new boxes with the text i would just like it to update the same box?

[inline]from Tkinter import *

def onclick():
pass

root = Tk()
text = Text(root)
with open('sensData.txt') as f:
newText = f.read()
text.insert(END, newText)
text.pack()
text.update_idletasks()

text.tag_add(newText, "1.0", "1.2")
text.tag_add("start", "1.0", "1.3", "2.0", "2.2")
text.tag_config("start", background="black", foreground="green")
root.mainloop()
[/inline]

(Mar-26-2018, 11:21 AM)Larz60+ Wrote:
self.T.configure(font= (family='Helvetica', size=14, weight='', fg='#0059b3')) 
Not tested, but if not this, very close, see:http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/fonts.html
fg = text forground color
color selection can be found here: https://www.w3schools.com/colors/colors_picker.asp
i tried something similar to that for the past 2 days ive been googling examples and i always get an error about syntax at the = signs. for the example you showed me i get a error about the syntax of the = after "family" sorry i didnt see you post before that last post i made. ive been experimenting with anything i can get close to work. this python is way different that the c++ on the arduino platform. until 2 days ago i have never messed with python.

sorry for blowing up this thread, but i think ive sorta figured some things out. ill start with this
" self.T.configure(fg='#0059b3', font=("bold", 22))" and see where i can get from here. thanks again
Reply


Messages In This Thread
Tkinter Font Color - by notsolowki - Mar-25-2018, 07:22 AM
RE: Tkinter Font Color - by Larz60+ - Mar-25-2018, 08:48 AM
RE: Tkinter Font Color - by notsolowki - Mar-26-2018, 10:14 AM
RE: Tkinter Font Color - by notsolowki - Mar-26-2018, 08:28 AM
RE: Tkinter Font Color - by Larz60+ - Mar-26-2018, 11:21 AM
RE: Tkinter Font Color - by notsolowki - Mar-26-2018, 11:24 AM
RE: Tkinter Font Color - by Larz60+ - Mar-26-2018, 04:09 PM
RE: Tkinter Font Color - by notsolowki - Mar-27-2018, 02:10 AM
RE: Tkinter Font Color - by Larz60+ - Mar-27-2018, 04:34 AM
RE: Tkinter Font Color - by notsolowki - Mar-27-2018, 05:09 AM
RE: Tkinter Font Color - by Larz60+ - Mar-27-2018, 10:52 AM
RE: Tkinter Font Color - by notsolowki - Mar-28-2018, 03:53 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Tkinter - How can I change the default Notebook border color? TurboC 5 14,994 May-23-2022, 03:44 PM
Last Post: bigmac
  Can't get tkinter button to change color based on changes in data dford 4 3,541 Feb-13-2022, 01:57 PM
Last Post: dford
  [Tkinter] Trouble changing Font within tkinter frame title AnotherSam 1 4,297 Sep-30-2021, 05:57 PM
Last Post: menator01
Question [Tkinter] Can I set background color for each item in tkinter Combobox? water 1 5,223 Dec-10-2020, 07:48 PM
Last Post: Larz60+
  Tkinter menu font size -method to change tonycat 2 7,983 Oct-11-2020, 02:43 AM
Last Post: tonycat
  tkinter | Button color text on Click Maryan 2 3,467 Oct-09-2020, 08:56 PM
Last Post: Maryan
  [Tkinter] How to Print a list = ['a','b','c'], using tkinter along with a custom font? Pleiades 2 2,446 Sep-15-2020, 03:54 PM
Last Post: Pleiades
  [tkinter] color change for hovering over button teacher 4 8,750 Jul-04-2020, 06:33 AM
Last Post: teacher
  TKINTER - Change font color for night or day Ayckinn 2 3,976 May-24-2020, 09:25 PM
Last Post: Ayckinn
  Tkinter help (color) Florent 2 2,410 Mar-01-2020, 02:59 PM
Last Post: Florent

Forum Jump:

User Panel Messages

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