OK!
c = Tkinter.Canvas(width=100, height=100, highlightthickness=0)
>>> c.winfo_reqwidth()
100
Con đường tôi sửa lỗi vấn đề cũng có thể hữu ích cho những người khác có nhu cầu:
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')}
Vì vậy, sau khi xem xét rằng tập hợp đầy đủ các cấu hình tôi đoán nó là một trong hai điểm nhấn hoặc tham số closeenough.
Bạn có thể xác nhận bằng trực quan câu trả lời này bằng cách sử dụng ví dụ sau: [link] (http://stackoverflow.com/a/11894636/1217270). Bạn có thể thấy một đường viền màu xám nhạt hơn, biến mất khi bạn thêm 'highlightthickness = 0'. –