From: SourceForge.net <no...@so...> - 2009-11-20 00:09:25
|
Bugs item #2900796, was opened at 2009-11-19 17:52 Message generated for change (Comment added) made by jeremy_c You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=2900796&group_id=12997 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: 88. Themed Tk Group: current: 8.5.8 Status: Open Resolution: None Priority: 5 Private: No Submitted By: Jeremy Cowgar (jeremy_c) Assigned to: Joe English (jenglish) Summary: ttk widgets do not initialize the textvariable Initial Comment: % entry .e -textvariable e % info exists e 1 % ttk::entry .e -textvariable e .e % info exists e 0 This requires you to either initialize it ahead of it's use or requires you to check info exists before any use of the variable. ---------------------------------------------------------------------- >Comment By: Jeremy Cowgar (jeremy_c) Date: 2009-11-19 19:09 Message: The right thing to do here is beyond me. I'll let others hash it out. If it's not a bug, you can do as you please with this ticket. ---------------------------------------------------------------------- Comment By: Joe English (jenglish) Date: 2009-11-19 18:49 Message: Examples of counterintuitive behaviour: # (1) set X "blah"; entry .e -textvariable X # ... unset X info exists X # ==> returns 1! # [2] set X "B" spinbox .sb -textvariable X -values {A B C} set X # ==> returns "A"! # [3] set X 2 spinbox .sb -textvariable X -from 1 -to 3 set X # ==> Still 2! unset X set X # ==> Now it's 1 again! More examples available on demand. ---------------------------------------------------------------------- Comment By: Joe English (jenglish) Date: 2009-11-19 18:39 Message: This behaviour is intentional, sensible, and consistent. The policy for linked variables (-textvariable, -variable, etc.) is: (1) The widget state reflects the value of the linked variable; and, (2) Widgets update linked variables in response to user input. The ttk::* widgets use a stronger policy: (2') widgets *only* update linked variables in response to user input. The core widgets mostly follow this policy as well, and in the cases where they don't it inevitably leads to counterintuitive behaviour. ---------------------------------------------------------------------- Comment By: Mark Janssen (mpc_janssen) Date: 2009-11-19 17:56 Message: This behaviour is different from the Tk entry widget which does initialize the textvariable. So even if there is a good reason for this behaviour, the fact that it's different from the behaviour in Tk adds an extra caveat for porting Tk code to Ttk. I am curious what reason could be so grave that the difference is justified. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=112997&aid=2900796&group_id=12997 |