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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T15:13:15+00:00 2026-06-13T15:13:15+00:00

Is there a way to achieve something similar to scripting in svg file, so

  • 0

Is there a way to achieve something similar to scripting in svg file, so it works when it’s opened in python gui? I need funcionality similar to one in this example, but I am opening my svg in python like this:

self.setScene(QtGui.QGraphicsScene(self))
self.scene().addItem(QtSvg.QGraphicsSvgItem(QtCore.QFile(pathToMySVG).fileName()))

where self is QtGui.QGraphicsView.

I have also tried without scripting, with these examples, but still there is no interactivity.

Any help-examples would be appreciated.

  • 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-13T15:13:16+00:00Added an answer on June 13, 2026 at 3:13 pm

    @Vicent Actually I’ve found solution using QGraphicsWebView():

    import sys
    from PyQt4 import QtCore, QtGui, QtSvg
    from PyQt4.QtWebKit import QGraphicsWebView
    if __name__ == "__main__":
        app = QtGui.QApplication(sys.argv)
    
        scene = QtGui.QGraphicsScene()
        view = QtGui.QGraphicsView(scene)
    
        br = QtSvg.QGraphicsSvgItem("C:\my_interactive_svg.svg").boundingRect()
    
        webview = QGraphicsWebView()
        webview.load(QtCore.QUrl("C:\my_interactive_svg.svg"))
        webview.setFlags(QtGui.QGraphicsItem.ItemClipsToShape)
        webview.setCacheMode(QtGui.QGraphicsItem.NoCache)
        webview.resize(br.width(), br.height())
    
        scene.addItem(webview)
        view.resize(br.width()+10, br.height()+10)
        view.show()
        sys.exit(app.exec_())
    

    It works perfect for me (scripting and other stuff).

    Only thing that I don’t like is that I have to load my svg as QGraphicsSvgItem, because I didn’t know other way to get size of my svg. Apparently webview.size() does not return expected values.

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

Sidebar

Related Questions

Is there a way to achieve transliteration of characters between charsets in java? something
Is there a way to achieve Backspace functionality in HTML? Do we have any
Is there any way to achieve compiling Node.js scripts as native code, like Hip-Hop
Is there any way to achieve this effect (3D CANVAS VIEW) for displaying an
Is there a way to achieve the following in Maven? I want to exclude
Is there any way to achieve a += operator within the css operator (assuming
Update: Is there a way to achieve what I'm trying to do in an
I would like to ask is there any way to achieve this functionality: I
I have elements structured roughly like this: http://jsfiddle.net/zyySd/ Is there any way to achieve
This has been introduced in C# 4.0, but is there a way to achieve

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.