GUI is non-responsive during a long database interaction

Liste des GroupesRevenir à cl tcl 
Sujet : GUI is non-responsive during a long database interaction
De : nospam.nurdglaw (at) *nospam* gmail.com (Alan Grunwald)
Groupes : comp.lang.tcl
Date : 06. Mar 2025, 18:42:36
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vqcmt3$32s62$1@dont-email.me>
User-Agent : Mozilla Thunderbird
Hi. The subject says it all really.
In more detail, I have an application that needs to access a database via  SELECT statement that takes around 30s to complete. Obviously I should look to tweak the database so as to speed it up. In the meantime, I tried to execute the database interaction in a separate thread (?) by running it as an [after idle] script but this didn't have the desired effect - i.e. the GUI remains unresponsive (btw the same thing happens if I run it as an [after N] script.
Is there any way to achieve what I'm trying to do, short of using the full threads package, which I've never used before and would like not to have to get to grips with right now.
Is there any way to kick of a database interaction with TDBC and get a callback when it completes?
By the way, my first workaround to provide user feedback that all is well was to set a different cursor while the SQL statement is executing. I found a list of valid cursors at https://www.tcl-lang.org/man/tcl9.0/TkCmd/cursors.html, but no pictures of the cursors, so I wrote the script below to display them. (I decided to go with "watch".)
I anticipate someone coming along in a bit to tell me that such a demo script already exists elsewhere.
###############################################################################
#
# Quick script to demonstrate available cursors
#
###############################################################################
package require tk
set cursors {
     X_cursor           arrow               based_arrow_down
     based_arrow_up     boat                bogosity
     bottom_left_corner bottom_right_corner bottom_side
     bottom_tee         box_spiral          center_ptr
     circle             clock               coffee_mug
     cross              cross_reverse       crosshair
     diamond_cross      dot                 dotbox
     double_arrow       draft_large         draft_small
     draped_box         exchange            fleur
     gobbler            gumby               hand1
     hand2              heart               icon
     iron_cross         left_ptr            left_side
     left_tee           leftbutton          ll_angle
     lr_angle           man                 middlebutton
     mouse              none                pencil
     plus               question_arrow      right_ptr
     right_side         right_tee           rightbutton
     rtl_logo           sailboat            sb_down_arrow
     sb_h_double_arrow  sb_left_arrow       sb_right_arrow
     sb_up_arrow        sb_v_double_arrow   shuttle
     sizing             spider              spraycan
     star               target              tcross
     top_left_arrow     top_left_corner     top_right_corner
     top_side           top_tee             trek
     ul_angle           umbrella            ur_angle
     watch              xterm
}
set nCols 4; # Number of columns in display
set row 0
set col 0
set mnu [menu .mnu]
set m [menu $mnu.f -tearoff no]
$mnu add cascade File -label File -menu $m
$m add command Quit -label Quit -command exit
. configure -menu $mnu
set frm [ttk::frame .frm]
pack $frm -expand yes -fill both
foreach cursor $cursors {
     set lbl [ttk::label .frm.l$cursor -text $cursor -cursor $cursor]
     grid $lbl -row $row -column $col -padx 3 -pady 3 -sticky nsew
     if {[incr col] > $nCols} {
set col 0
incr row
     }
}
vwait forever

Date Sujet#  Auteur
6 Mar 25 * GUI is non-responsive during a long database interaction4Alan Grunwald
6 Mar 25 +* Re: GUI is non-responsive during a long database interaction2Rich
6 Mar 25 i`- Re: GUI is non-responsive during a long database interaction1ted@loft.tnolan.com (Ted Nolan
6 Mar 25 `- Re: GUI is non-responsive during a long database interaction1et99

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal