I am trying to make a simple data editor in Tkinter where each data
element has a corresponding Entry widget. I have tried to use the
FocusIn/FocusOut events to set a 'hasChanged' flag (if a record has not
changed, the db doesn’t need updating). This seems to work fine except
that when the user finishes and clicks a ‘done’ button or the close
window button (in the root widget) no FocusOut event is triggered. I
can trigger a FocusOut event if the ‘done’ button opens another window
(i.e. a messagebox) that takes focus. Enter and Leave follow the mouse,
but don’t trigger when the user tabs between fields.
Is there a better way to monitor 'hasChanged'? Also, how do I capture
the root window close button?
Thanks,
Bill 2 4301
William Gill wrote: I am trying to make a simple data editor in Tkinter where each data element has a corresponding Entry widget. I have tried to use the FocusIn/FocusOut events to set a 'hasChanged' flag (if a record has not changed, the db doesn't need updating). This seems to work fine except that when the user finishes and clicks a 'done' button or the close window button (in the root widget) no FocusOut event is triggered. I can trigger a FocusOut event if the 'done' button opens another window (i.e. a messagebox) that takes focus. Enter and Leave follow the mouse, but don't trigger when the user tabs between fields.
Is there a better way to monitor 'hasChanged'?
I'd go with monitoring keypresses in the Entry widget.
Also, how do I capture the root window close button?
root = Tk()
root.protocol("WM_DELETE_WINDOW", onexit)
Jonathan Ellis wrote: William Gill wrote:
I am trying to make a simple data editor in Tkinter where each data element has a corresponding Entry widget. I have tried to use the FocusIn/FocusOut events to set a 'hasChanged' flag (if a record has not changed, the db doesn't need updating). This seems to work fine except that when the user finishes and clicks a 'done' button or the close window button (in the root widget) no FocusOut event is triggered. I can trigger a FocusOut event if the 'done' button opens another window (i.e. a messagebox) that takes focus. Enter and Leave follow the mouse, but don't trigger when the user tabs between fields.
Is there a better way to monitor 'hasChanged'?
I'd go with monitoring keypresses in the Entry widget.
Well, It doesn't seem logical to do a before and after test of the Entry
values after each keypress, but I suppose I could monitor keypresses,
test event.key for Tab (in case the user tabbed out of the widget w/o
making any changes.
Is that along the lines of what you are suggesting?
Also, how do I capture the root window close button?
root = Tk() root.protocol("WM_DELETE_WINDOW", onexit)
I had seen something like this somewhere, but couldn't remember where.
Thanks to your reminder I found an example of "Capturing destroy
events." Since that will allow me to route the exit process through a
tkMessageBox, it may be just as good to continue using FocusIn/FocusOut
events. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Matthew Wilson |
last post by:
Hi -
I wrote this program:
import Tkinter
root = Tkinter.Tk()
root.title('tkfun is tktastic!')
cc = Tkinter.Canvas(root, width=400, height=400, bg="white")
|
by: Fuzzyman |
last post by:
I'm having trouble implementing my GUI using Tkinter......
I've been working through the Tkinter tutorials from 'Programming
Python' and am generally happy enough with the functionality and feel...
|
by: Derek |
last post by:
Hello:
I want to capture the event when a browser is closing, to give to the user
the posibility of close or no this browser. When the browser is closing,
this show a confirm window with two...
|
by: syed_saqib_ali |
last post by:
Below is a simple code snippet showing a Tkinter Window bearing a
canvas and 2 connected scrollbars (Vertical & Horizontal). Works fine.
When you shrink/resize the window the scrollbars adjust...
|
by: syed_saqib_ali |
last post by:
Below is a simple code snippet showing a Tkinter Window bearing a
canvas and 2 connected scrollbars (Vertical & Horizontal). Works fine.
When you shrink/resize the window the scrollbars adjust...
|
by: feng |
last post by:
Hi,
In our asp.net app, we need to capture the event when user
close the browser window by clicking on the "x" button.
But it doesn't seem to be as easy as it sound. Can someone
show me how to...
|
by: Bill Manring |
last post by:
I need to capture the event when the user closes the browser in my
application. I have some code in the session_End event, which works fine
when the session times out, but I need to end the...
|
by: iwl |
last post by:
Hi,
I tryed askstring to input some text in my script,
but some ugly empty Window appears with the
Input-Window behind and all together behind my
Console showing my script. So all have to...
|
by: destiny007 |
last post by:
can any one help me to write code to capture selected text from a page but problem is that i am not able to decide where to call the functio.in this case the function is called in all cases of mouse...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |