Deutsch English Français Italiano |
<vqcmt3$32s62$1@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!weretis.net!feeder9.news.weretis.net!news.quux.org!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Alan Grunwald <nospam.nurdglaw@gmail.com> Newsgroups: comp.lang.tcl Subject: GUI is non-responsive during a long database interaction Date: Thu, 6 Mar 2025 17:42:36 +0000 Organization: A noiseless patient Spider Lines: 92 Message-ID: <vqcmt3$32s62$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Thu, 06 Mar 2025 18:44:03 +0100 (CET) Injection-Info: dont-email.me; posting-host="10fb98892566884306a674e69e70ba20"; logging-data="3240130"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ENF9RtbMIR5ucd+49gBF74DEXwiWnCAk=" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:tvNTSA9hYdZ1FlxsGNz//NbtHQA= Content-Language: en-US Bytes: 4500 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