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

  • Home
  • SEARCH
  • 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 8461869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T13:59:59+00:00 2026-06-10T13:59:59+00:00

Mathematica DynamicModule[{list = {}}, EventHandler[ Dynamic[Framed@ Graphics[{BSplineCurve[list], Red, Line[list], Point[list]}, PlotRange -> 2]], {{MouseClicked,

  • 0

Mathematica

DynamicModule[{list = {}}, 
 EventHandler[
  Dynamic[Framed@
    Graphics[{BSplineCurve[list], Red, Line[list], Point[list]}, 
     PlotRange -> 2]], {{"MouseClicked", 
     1} :> {AppendTo[list, 
      MousePosition["Graphics"]]}}, {"MouseClicked", 2} :> 
   Print[list]]]

I want to do the above at home where I do not have Mathematica. Use whatever tool you want, I like to use Python and R but happy with any solution candidate. The first thing that came to my mind was RStudio and this question here but I am unsure whether some better way to do this.

How can I do the interactive-GUI-innovating over X?

Procedure of the Mathematica -snippet outlined

1. you click points

2. you will see BSplineCurve formating between the points and points are red

3. points are saved to an array

4. when finished, you click `right-mouse-button` so array to stdout
  • 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-06-10T14:00:01+00:00Added an answer on June 10, 2026 at 2:00 pm

    Here is an R function that does what you describe:

    dynmodfunc <- function() {
        plot(0:1,0:1,ann=FALSE,type='n')
        mypoints <- matrix(ncol=2, nrow=0)
        while( length(p <- locator(1, type='p', col='red')) ) {
            mypoints <- rbind(mypoints, unlist(p))
            plot(mypoints, col='red', ann=FALSE, xlim=0:1, ylim=0:1)
            if(nrow(mypoints)>1) {
                xspline(mypoints, shape=-1)
            }
        }
        mypoints
    }
    
    (out <- dynmodfunc())
    

    You can change the shape argument to xspline to change the style of spline. This version returns a 2 column matrix with the x and y values, but that could be changed to another structure if prefered. There are plenty of other things that could be customized as well.

    Added function to get the output to paste into Mathematica:

    matrix2mathematica <- function(x) {
        paste0( '{', 
            paste0( '{', x[,1], ', ', x[,2], '}', collapse=', '),
        '}')
    }
    
    cat( matrix2mathematica(out))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In Mathematica I have a list of point coordinates size = 50; points =
Could anyone point out why this is not working in Mathematica 8: DynamicModule[{x =
Mathematica's list of built-in formats is pretty extensive; however, JSON is not on that
In Mathematica I have a list: x = {1,2,3,3,4,5,5,6} How will I make a
The problem is that I want to output Mathematica compatible floating point numbers. The
Consider the following dialog with the command-line interface to the kernel: $ math Mathematica
Does mathematica have something like select any that gets any element of a list
Mathematica documentation states: Text in three-dimensional graphics is placed at a position that corresponds
Does Mathematica support hidden line removal for wire frame images? If this isn't the
Mathematica provides many functions which are capable of handling Dynamic as an argument. For

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.