Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 522269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:20:11+00:00 2026-05-13T08:20:11+00:00

I am currently writing a fsm editor with tkinter. But, I stuck on connecting

  • 0

I am currently writing a fsm editor with tkinter. But, I stuck on connecting two states. I have two questions:

1) How can make the transition arrow growable according to mouse movement?

2) How can I stick the starting point of the arrow on a state and the end point of the arrow on another state?

PS. Do you think the documentation of tkinter is good enough?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T08:20:12+00:00Added an answer on May 13, 2026 at 8:20 am

    Here’s an example that shows the concept. In a nutshell, use tags to associate lines with boxes, and simply adjust the coordinates appropriately when the user moves the mouse.

    Run the example, then click and drag from within the beige box.

    Of course, for production code you need to make a more general solution, but hopefully this shows you how easy it is to create a box with arrows that adjust as you move the box around.

    from Tkinter import *
    
    class CanvasDemo(Frame):
        def __init__(self, width=200, height=200):
            Frame.__init__(self, root)
            self.canvas = Canvas(self)
            self.canvas.pack(fill="both", expand="1")
            self.canvas.create_rectangle(50, 25, 150, 75, fill="bisque", tags="r1")
            self.canvas.create_line(0,0, 50, 25, arrow="last", tags="to_r1")
            self.canvas.bind("<B1-Motion>", self.move_box)
            self.canvas.bind("<ButtonPress-1>", self.start_move)
    
        def move_box(self, event):
            deltax = event.x - self.x
            deltay = event.y - self.y
            self.canvas.move("r1", deltax, deltay)
            coords = self.canvas.coords("to_r1")
            coords[2] += deltax
            coords[3] += deltay
            self.canvas.coords("to_r1", *coords)
            self.x = event.x
            self.y = event.y
    
        def start_move(self, event):
            self.x = event.x
            self.y = event.y
    
    root = Tk()
    canvas = CanvasDemo(root)
    canvas.pack()
    mainloop()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am currently writing a distributed system using hazelcast. I have a few questions
The application I'm currently writing is using MVVM with the ViewModel-first pattern. I have
I'm currently writing a small script using pygame, but I don't believe this question
I am currently writing some extensions in twig, but I am having trouble deciding
I am currently writing a project where I make a heavy use of ListT
I am currently writing some code that can access a separate workbook through an
I'm currently writing a class that implements the SeekableIterator interface and have run into
Im currently writing a C# wrapper for a C++ API, but a specific struct
I'm currently writing a small test Android app, and have run across a small
I'm currently writing an custom control which has to hold child control and have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.