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 8098077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:58:02+00:00 2026-06-05T21:58:02+00:00

Okay..the output of a python program is shown into a Tkinter window..which opens separately.

  • 0

Okay..the output of a python program is shown into a Tkinter window..which opens separately. What I want to do is to embed this window within the browser. Here is the code:

import numpy as np
import matplotlib
import matplotlib.cbook as cbook
import matplotlib.image as image
import matplotlib.pyplot as plt

datafile = cbook.get_sample_data('logo2.png', asfileobj=False)

print 'loading', datafile

im = image.imread(datafile)

im[:,:,-1] = 0.5  # set the alpha channel

fig = plt.figure()

ax = fig.add_subplot(111)

ax.plot(np.random.rand(20), '-o', ms=20, lw=2, alpha=0.7, mfc='orange')

ax.grid()

fig.figimage(im, 10, 10)

plt.show()

Consider that all the variables are input parameters that are given from a browser form field. Please help!! 🙂

  • 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-05T21:58:03+00:00Added an answer on June 5, 2026 at 9:58 pm

    Based on Joe Kington’s answer to a similar question, the backend mplh5canvas is possibly what you are looking for. Adapting your example code to work with it,

    import numpy as np
    import matplotlib
    import mplh5canvas
    
    matplotlib.use('module://mplh5canvas.backend_h5canvas')
    
    import matplotlib.cbook as cbook
    import matplotlib.image as image
    import matplotlib.pyplot as plt
    
    
    fig = plt.figure()
    
    ax = fig.add_subplot(111)
    
    ax.plot(np.random.rand(20), '-o', ms=20, lw=2, alpha=0.7, mfc='orange')
    
    ax.grid()
    
    plt.show(open_plot=True)
    

    It seems to work well with the kind of interactivity you are looking for, even allowing animation. Having said that, it doesn’t support every browser, as described in it’s installation wiki page. If it is acceptable to restrict use to Chrome, Safari or Opera (in this case with some configuration, check that page) then it should suit you well, though might need some experimentation as well.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Okay, this is quite an interesting challenge I have got myself into. My RegEx
Okay, let's say that I have b.exe, which takes a string argument. I want
Okay, so what I want to do is directly output formatted RTF text to
Okay, so here's my problem: We use FOP for creating pretty report output. We
Okay this question is very simple: I have a facebook page, and a website.
Okay, I feel a bit foolish for having to ask this but I guess
Okay - I have a dilemma. So far my script converts page titles into
Okay, this is probably a very basic question; but, I'm just getting back in
Okay, I have absolutely NO Compiler/Output errors anymore...however, the buttons are still not working?
I'm running into a problem with the following Python 3.2.2 code. The code is

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.