954,541 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

issue with Tkinter canvas widget

Hello everybody,

I've a somewhat odd issue displaying a .png image onto a Tkinter canvas.
The image is surrounded by a grey frame.
Here below an excerpt of the relevant code and by the way I'm running under windows xp.
The same thing happens with the menu of the gui, it stays grey whatever colour I set.
Any suggestion about this issue?

self.frameCanvas = Frame(master, bg="white", bd=0, relief=FLAT)
self.frameCanvas.grid(column=1, row=0, rowspan=2, sticky=NE, padx=10, pady=5)
#
self.logo = Canvas(self.frameCanvas, width=70, height=70, bg="white", bd=0)
self.logo.create_image(36, 36, image=self.Logo_TCTK)
self.logo.grid()
self.logo.image = self.Logo_TCTK


Thank you all

Attachments canvas.JPG 6.21KB
TheOneElectroni
Light Poster
27 posts since Jun 2008
Reputation Points: 10
Solved Threads: 2
 

You might have to give us some more of your code. Don't be bashful!

Ene Uran
Posting Virtuoso
1,723 posts since Aug 2005
Reputation Points: 625
Solved Threads: 213
 

I can indeed give you the full code of the app infrastructure which is the one creating the gui's aspect and common widgets. This part then call the various modules which I don't include here as I don't think they're useful to solve the problem.
Be warned that the code is rude and not at all smooth and clean

Thanks to all again.

Gab

Attachments P_list.txt (13.2KB)
TheOneElectroni
Light Poster
27 posts since Jun 2008
Reputation Points: 10
Solved Threads: 2
 
Gribouillis
Posting Maven
Moderator
2,786 posts since Jul 2008
Reputation Points: 1,044
Solved Threads: 691
 

that's it!
Thank you so much!

By the way, any advice to change the default menu grey colour? Just setting the bg option doesn't work. Somewhere I read it's a Tkinter bug.
Any idea?

Gab

TheOneElectroni
Light Poster
27 posts since Jun 2008
Reputation Points: 10
Solved Threads: 2
 

google is your friend !
I post the solution here, for future reference:

set highlightthickness to 0 (zero)

Gribouillis
Posting Maven
Moderator
2,786 posts since Jul 2008
Reputation Points: 1,044
Solved Threads: 691
 

That works fine indeed on the canvas widget.
For the menu it's not a valid option however.
I tried and googled some time ago and found only one reference stating that the bg setting in the menu widget it's broken.
That's why I was wondering if someone of you already faced such a problem.

TheOneElectroni
Light Poster
27 posts since Jun 2008
Reputation Points: 10
Solved Threads: 2
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You