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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T12:00:01+00:00 2026-05-27T12:00:01+00:00

We currently have a fully functional Gui written created using PyQt. My partner wrote

  • 0

We currently have a fully functional Gui written created using PyQt. My partner wrote a function that graphs a dataSet in Tkinter. My question is, how do we combine the two so they work together?

Here is the graphing function:

def createGraph(self):
        import tkinter as tk

        # Send in data as param, OR
        #data = [17, 20, 15, 10, 7, 5, 4, 3, 2, 1, 1, 0]        

        # Recieve data within function 
        s.send("loadgraph")

        inputString = repr(s.recv(MSGSIZE))
        #inputString = "-20 15 10 7 5 -4 3 2 1 1 0"
        print(inputString)
        data = [int(x) for x in inputString.split()]

        root = tk.Tk()
        root.title("FSPwners")
        screen_width = 400
        screen_height = 700
        screen = tk.Canvas(root, width=screen_width, height=screen_height, bg= 'white')
        screen.pack()

        # highest y = max_data_value * y_stretch
        y_stretch = 15
        # gap between lower canvas edge and x axis
        y_gap = 350
        # stretch enough to get all data items in
        x_stretch = 10
        x_width = 20
        # gap between left canvas edge and y axis
        x_gap = 20


        for x, y in enumerate(data):
            # calculate reactangle coordinates (integers) for each bar
            x0 = x * x_stretch + x * x_width + x_gap
            y0 = screen_height - (y * y_stretch + y_gap)
            x1 = x * x_stretch + x * x_width + x_width + x_gap
            y1 = screen_height - y_gap
            # draw the bar
            print(x0, y0, x1, y1)
            if y < 0:
                screen.create_rectangle(x0, y0, x1, y1, fill="red")
            else:
                screen.create_rectangle(x0, y0, x1, y1, fill="green")

            # put the y value above each bar
            screen.create_text(x0+2, y0, anchor=tk.SW, text=str(y))

        root.mainloop()

When that method is run by itself, it creates a popup box with the graph. Now we want it to create a popup graph when a button is pressed in our current gui. How can we get it to work? If we just call createGraph() when a button is clicked in our GUI, we get the error:
unrecognized selector sent to instance x009x…

What is the problem? Thanks!

  • 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-27T12:00:01+00:00Added an answer on May 27, 2026 at 12:00 pm

    Qt and Tkinter don’t play along quite well, as you can perceive –
    I had once played along Python graphical toolkits, and wrote
    a 4 operation calculator that would run in either Qt, GTK or Tkinter –
    or even display all at once.

    In order to have both the Tkinter and Qt versions working simultaneously,
    I had to fork the process – and start each toolkit in a separate
    running instance;

    Your case is not identical, as the Qt GUI will be already running, but maybe
    having this to start up with you can come along with a work-around.

    The 3-calculators code listing can be found here:

    https://web.archive.org/web/20101122232402/http://www.python.org.br/wiki/CalculadoraTkGtkQt

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

Sidebar

Related Questions

I have created a functional OOP program that uses a bunch of classes, and
I have a fully-functional Java program that's fairly long, and I want to transfer
I've created a Basic MSI project and have a fully functional installer. Some directories
I have a datepicker that is fully functional and is working whereby you can
I currently have an MS Access application that connects to a PostgreSQL database via
I currently have an existing database and I am using the LINQtoSQL generator tool
I currently have a class and I'm trying to create an easy GUI to
I have an existing, fully functional Spring web application based on Spring 2.5.6 -
I currently have script that slides down a once the page has loaded. So
I have to process a large byte array that is passed to my function.

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.