• Screen coordinates

    From mikkelstuff@21:1/5 to All on Fri Jan 13 18:26:09 2023
    I need to capture the screen coordinates when touching a left mouse button. Seems like "canvas" should do this but I just do not see it. Any other ideas?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Rich@21:1/5 to mikkelstuff on Sat Jan 14 03:26:35 2023
    mikkelstuff <clark.mikkelsen@gmail.com> wrote:
    I need to capture the screen coordinates when touching a left mouse
    button. Seems like "canvas" should do this but I just do not see it.
    Any other ideas?

    Do the %X and %Y substitutions for bindings not provide what you are
    looking for?

    Or 'winfo pointerxy'?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luc@21:1/5 to mikkelstuff on Sat Jan 14 14:31:20 2023
    On Fri, 13 Jan 2023 18:26:09 -0800 (PST), mikkelstuff wrote:

    I need to capture the screen coordinates when touching a left mouse
    button. Seems like "canvas" should do this but I just do not see it. Any other ideas?


    bind $canvaswidget <ButtonRelease-1> {$textwidget delete 1.0 end; $textwidget insert end [%W canvasx %x]/[%W canvasy %y]}

    or

    bind $canvaswidget <ButtonRelease-1> {puts [%W canvasx %x]/[%W canvasy %y]}


    --
    Luc


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Luc@21:1/5 to mikkelstuff on Sat Jan 14 17:56:34 2023
    On Sat, 14 Jan 2023 12:22:27 -0800 (PST), mikkelstuff wrote:

    On Saturday, January 14, 2023 at 10:31:25 AM UTC-7, Luc wrote:
    On Fri, 13 Jan 2023 18:26:09 -0800 (PST), mikkelstuff wrote:

    I need to capture the screen coordinates when touching a left mouse button. Seems like "canvas" should do this but I just do not see it.
    Any other ideas?
    bind $canvaswidget <ButtonRelease-1> {$textwidget delete 1.0 end; $textwidget insert end [%W canvasx %x]/[%W canvasy %y]}

    or

    bind $canvaswidget <ButtonRelease-1> {puts [%W canvasx %x]/[%W canvasy
    %y]}


    --
    Luc

    Got it! Sorry but I have not programmed in Tcl/Tk since retirement and am rusty. Ok, rusty geezer. Thanks all


    Please note those are not the coordinates of the screen. They are
    the coordinates of the canvas, and the canvas has its own idea of what
    x and y mean. I believe a canvas puts 0,0 on the bottom right corner
    by default, such that everything you can see sits on negative (less
    than zero) coordinates. I'm not really sure though. Anyway, you will
    probably have to adjust the position of the canvas yourself before
    you use it.

    For example:

    set ::canvaswidget $::w.outer.canvasframe.canvaswidget
    canvas $::canvaswidget
    $::canvaswidget configure -bg white
    $::canvaswidget configure -height 900 -width 1900
    $::canvaswidget configure -xscrollincrement 1
    $::canvaswidget configure -yscrollincrement 1
    $::canvaswidget configure -scrollregion [list 0 -900 19200 0]
    $::canvaswidget xview moveto 0.0
    $::canvaswidget yview moveto 0.45

    Those values are pretty random here since I don't know what you
    want or need. Your case will certainly require different values.


    --
    Luc


    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From mikkelstuff@21:1/5 to Luc on Sat Jan 14 12:22:27 2023
    On Saturday, January 14, 2023 at 10:31:25 AM UTC-7, Luc wrote:
    On Fri, 13 Jan 2023 18:26:09 -0800 (PST), mikkelstuff wrote:

    I need to capture the screen coordinates when touching a left mouse
    button. Seems like "canvas" should do this but I just do not see it. Any other ideas?
    bind $canvaswidget <ButtonRelease-1> {$textwidget delete 1.0 end; $textwidget insert end [%W canvasx %x]/[%W canvasy %y]}

    or

    bind $canvaswidget <ButtonRelease-1> {puts [%W canvasx %x]/[%W canvasy %y]}


    --
    Luc

    Got it! Sorry but I have not programmed in Tcl/Tk since retirement and am rusty. Ok, rusty geezer.
    Thanks all

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Francois Vogel@21:1/5 to All on Sun Jan 15 15:02:19 2023
    Le 14/01/2023 à 03:26, mikkelstuff a écrit :
    I need to capture the screen coordinates when touching a left mouse button.

    Depending on the coordinates system in which you want to obtain the
    values, I suggest reading the manual for [winfo pointerxy] and/or [winfo rootx/rooty].

    Regards,
    Francois

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Harald Oehlmann@21:1/5 to All on Mon Jan 16 13:11:44 2023
    Background:
    In medical applications (medical device/pharmaceutics), often a user verification is required, even if the same user is already logged in.
    This is to check, if the user is really in front of the screen and
    approves the current process.

    Request:
    In consequence, I would like on a WIndows system to:
    - present a Tk screen: Username/Password
    - then verify the entered username/password against the system the
    computer is in. This may be a local user or a user in the active directory.

    TWAPI looks to be helpful here.
    get_users -level 1
    returns the -password field, what is always empty for me.

    Are there any other ideas to find a solution ?

    Thank you all,
    Harald

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ralf Fassel@21:1/5 to All on Mon Jan 16 14:50:14 2023
    * Harald Oehlmann <wortkarg3@yahoo.com>
    | Request:
    | In consequence, I would like on a WIndows system to:
    | - present a Tk screen: Username/Password
    | - then verify the entered username/password against the system the
    | computer is in. This may be a local user or a user in the active
    | directory.

    | TWAPI looks to be helpful here.

    Check [open_user_token] in TWAPI:

    https://twapi.magicsplat.com/v4.7/security.html#open_user_token

    It seems to be the wrapper around LogonUser(), which from what I read is
    *the* method to verify user/passwd.

    HTH
    R'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Harald Oehlmann@21:1/5 to All on Mon Jan 16 16:38:52 2023
    Am 16.01.2023 um 14:50 schrieb Ralf Fassel:
    * Harald Oehlmann <wortkarg3@yahoo.com>
    | Request:
    | In consequence, I would like on a WIndows system to:
    | - present a Tk screen: Username/Password
    | - then verify the entered username/password against the system the
    | computer is in. This may be a local user or a user in the active
    | directory.

    | TWAPI looks to be helpful here.

    Check [open_user_token] in TWAPI:

    https://twapi.magicsplat.com/v4.7/security.html#open_user_token

    It seems to be the wrapper around LogonUser(), which from what I read is *the* method to verify user/passwd.

    Wow, great, works great !

    Thanks,
    Harald

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)