Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8394315
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T20:01:38+00:00 2026-06-09T20:01:38+00:00

>>> import Tkinter >>> c = Tkinter.Canvas(width=100, height=100) >>> c.winfo_reqwidth() 104 >>> c.winfo_reqheight() 104

  • 0
>>> import Tkinter
>>> c = Tkinter.Canvas(width=100, height=100)
>>> c.winfo_reqwidth()
104
>>> c.winfo_reqheight()
104

The results are the same if I set borderwidth to zero. I can’t find the setting or property that explains or controls these 4 extra pixels.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T20:01:39+00:00Added an answer on June 9, 2026 at 8:01 pm

    Got it!

    c = Tkinter.Canvas(width=100, height=100, highlightthickness=0)
    >>> c.winfo_reqwidth()
    100
    

    The way I debugged the problem may also be useful to others in need:

    import pprint
    pprint.pprint(c.configure())
    {'background': ('background',
                    'background',
                    'Background',
                    'SystemButtonFace',
                    'SystemButtonFace'),
     'bd': ('bd', 'borderWidth'),
     'bg': ('bg', 'background'),
     'borderwidth': ('borderwidth', 'borderWidth', 'BorderWidth', '0', '0'),
     'closeenough': ('closeenough', 'closeEnough', 'CloseEnough', '1', '1.0'),
     'confine': ('confine', 'confine', 'Confine', '1', '1'),
     'cursor': ('cursor', 'cursor', 'Cursor', '', ''),
     'height': ('height', 'height', 'Height', '7c', '100'),
     'highlightbackground': ('highlightbackground',
                             'highlightBackground',
                             'HighlightBackground',
                             'SystemButtonFace',
                             'SystemButtonFace'),
     'highlightcolor': ('highlightcolor',
                        'highlightColor',
                        'HighlightColor',
                        'SystemWindowFrame',
                        'SystemWindowFrame'),
     'highlightthickness': ('highlightthickness',
                            'highlightThickness',
                            'HighlightThickness',
                            '2',
                            '0'),
     'insertbackground': ('insertbackground',
                          'insertBackground',
                          'Foreground',
                          'SystemButtonText',
                          'SystemButtonText'),
     'insertborderwidth': ('insertborderwidth',
                           'insertBorderWidth',
                           'BorderWidth',
                           '0',
                           '0'),
     'insertofftime': ('insertofftime', 'insertOffTime', 'OffTime', '300', '300'),
     'insertontime': ('insertontime', 'insertOnTime', 'OnTime', '600', '600'),
     'insertwidth': ('insertwidth', 'insertWidth', 'InsertWidth', '2', '2'),
     'offset': ('offset', 'offset', 'Offset', '0,0', '0,0'),
     'relief': ('relief', 'relief', 'Relief', 'flat', 'flat'),
     'scrollregion': ('scrollregion', 'scrollRegion', 'ScrollRegion', '', ''),
     'selectbackground': ('selectbackground',
                          'selectBackground',
                          'Foreground',
                          'SystemHighlight',
                          'SystemHighlight'),
     'selectborderwidth': ('selectborderwidth',
                           'selectBorderWidth',
                           'BorderWidth',
                           '1',
                           '1'),
     'selectforeground': ('selectforeground',
                          'selectForeground',
                          'Background',
                          'SystemHighlightText',
                          'SystemHighlightText'),
     'state': ('state', 'state', 'State', 'normal', 'normal'),
     'takefocus': ('takefocus', 'takeFocus', 'TakeFocus', '', ''),
     'width': ('width', 'width', 'Width', '10c', '100'),
     'xscrollcommand': ('xscrollcommand',
                        'xScrollCommand',
                        'ScrollCommand',
                        '',
                        ''),
     'xscrollincrement': ('xscrollincrement',
                          'xScrollIncrement',
                          'ScrollIncrement',
                          '0',
                          '0'),
     'yscrollcommand': ('yscrollcommand',
                        'yScrollCommand',
                        'ScrollCommand',
                        '',
                        ''),
     'yscrollincrement': ('yscrollincrement',
                          'yScrollIncrement',
                          'ScrollIncrement',
                          '0',
                          '0')}
    

    So after looking at that full set of configurations I guessed it was either the highlight or closeenough parameter.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

from Tkinter import * root = Tk() cv = Canvas(root) cv.create_rectangle(10,10,50,50) cv.pack() root.mainloop() I
Why can't I see a red frame with the following code? import Tkinter root
#!/usr/bin/python # -*- coding: iso-8859-1 -*- import Tkinter import twitter class simpleapp_tk(Tkinter.Tk): def __init__(self,parent):
#!/usr/bin/python # -*- coding: iso-8859-1 -*- import Tkinter class simpleapp_tk(Tkinter.Tk): def __init__(self,parent): Tkinter.Tk.__init__(self,parent) self.parent=parent
from Tkinter import * app = Tk() text_field = Entry(app) text_field.pack() app.mainloop() I want
Something like this: from Tkinter import * root = Tk() but = Button(root, text
I've created this simple GUI: from tkinter import * root = Tk() def grabText(event):
I'm trying to save my canvas using the postscript method, and Tkinter crashes... w.postscript(file=my_drawing.ps,
import tkinter class App(): def __init__(self): self.root = Tkinter.Tk() button = Tkinter.Button(self.root, text =
I have the following python code... import Tkinter root = Tkinter.Tk() root.tk.eval('puts {printed by

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.