Pylab - 'module' object has no attribute 'Figure'

martin

I'm trying to use Tkinter to create a view, and therefore I'm also using pylab. My problem is that I get an error saying:

AttributeError: 'module' object has no attribute 'Figure'

and the error comes from this line of code:

self.fig = FigureCanvasTkAgg(pylab.figure(), master=self)

I'm new to python, so I don't know how to fix this, since the figure() should be a part of the pylab library.

Any suggestions on how to fix this would be appreciated.

EDIT:

Here's the full code:

from Tkinter import *
import ttk
from ttk import Style
import pylab
from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
import matplotlib.pyplot as plt
from numpy import cumsum
import matplotlib

class GUI(Frame):
    def __init__(self, parent, motspiller):
        Frame.__init__(self, parent)
        self.style = Style()
        self.fig = None
    def setup(self):
        self.style.theme_use("default")
        self.pack(fill=BOTH, expand=1)
        label = Label(self.parent)
        label.place(x=800, y=50)
        quit_button = Button(self, text="Quit", command=self.quit)
        quit_button.place(x=1000, y=450)

        self.fig = FigureCanvasTkAgg(pylab.figure(), master=self)
        self.fig.get_tk_widget().grid(column=0, row=0)
        self.fig.show()
sevko

If you're unable to run any of the other pylab functions then there's a problem with your install. I just ran into a similar error when I installed matplotlib and then pylab, and it turns out that installing matplotlib will also install pylab for you and that separately installing pylab on top of it will cause those exact problems. A simple pip uninstall pylab did it for me, since it removed the newly installed pylab and let me import the one that came bundled with matplotlib instead.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

AttributeError: 'Figure' object has no attribute 'plot'

From Dev

Custom Module - Object Has No Attribute

From Dev

AttributeError: 'module' object has no attribute

From Dev

'module' object has no attribute 'Serial'

From Dev

'module' object has no attribute 'DataFrame'

From Dev

AttributeError: 'module' object has no attribute

From Dev

'module' object has no attribute 'GeoSQLCompiler'

From Dev

AttributeError: 'module' object has no attribute

From Dev

module object has no attribute oauth

From Dev

'module' object has no attribute 'get'?

From Dev

module' object has no attribute 'SelectDateWidget'

From Dev

'module' object has no attribute 'GeoSQLCompiler'

From Dev

'module' object has no attribute 'cut'

From Dev

'module' object has no attribute 'shortcuts'

From Dev

'module' object has no attribute 'get'?

From Dev

'module' object has no attribute 'TK'

From Dev

plot.subplot ---> 'Figure' object has no attribute 'plot'

From Dev

Plotly AttributeError: 'Figure' object has no attribute 'update_layout'

From Dev

AttributeError:'module' object has no attribute 'call' :Python

From Dev

AttributeError: 'module' object has no attribute 'tk'

From Dev

AttributeError: 'module' object has no attribute 'cache'

From Java

AttributeError: 'module' object has no attribute 'tests'

From Dev

'module' object has no attribute 'views' django error

From Dev

AttributeError: 'module' object has no attribute 'TestCase'

From Dev

AttributeError: 'module' object has no attribute 'version'

From Dev

Mtaplotlib AttributeError: 'module' object has no attribute 'pyplot'

From Dev

Using numpy 'module' object has no attribute 'array'

From Dev

AttributeError: 'module' object has no attribute 'plotting'

From Dev

Python - 'module' object has no attribute 'randrange'

Related Related

  1. 1

    AttributeError: 'Figure' object has no attribute 'plot'

  2. 2

    Custom Module - Object Has No Attribute

  3. 3

    AttributeError: 'module' object has no attribute

  4. 4

    'module' object has no attribute 'Serial'

  5. 5

    'module' object has no attribute 'DataFrame'

  6. 6

    AttributeError: 'module' object has no attribute

  7. 7

    'module' object has no attribute 'GeoSQLCompiler'

  8. 8

    AttributeError: 'module' object has no attribute

  9. 9

    module object has no attribute oauth

  10. 10

    'module' object has no attribute 'get'?

  11. 11

    module' object has no attribute 'SelectDateWidget'

  12. 12

    'module' object has no attribute 'GeoSQLCompiler'

  13. 13

    'module' object has no attribute 'cut'

  14. 14

    'module' object has no attribute 'shortcuts'

  15. 15

    'module' object has no attribute 'get'?

  16. 16

    'module' object has no attribute 'TK'

  17. 17

    plot.subplot ---> 'Figure' object has no attribute 'plot'

  18. 18

    Plotly AttributeError: 'Figure' object has no attribute 'update_layout'

  19. 19

    AttributeError:'module' object has no attribute 'call' :Python

  20. 20

    AttributeError: 'module' object has no attribute 'tk'

  21. 21

    AttributeError: 'module' object has no attribute 'cache'

  22. 22

    AttributeError: 'module' object has no attribute 'tests'

  23. 23

    'module' object has no attribute 'views' django error

  24. 24

    AttributeError: 'module' object has no attribute 'TestCase'

  25. 25

    AttributeError: 'module' object has no attribute 'version'

  26. 26

    Mtaplotlib AttributeError: 'module' object has no attribute 'pyplot'

  27. 27

    Using numpy 'module' object has no attribute 'array'

  28. 28

    AttributeError: 'module' object has no attribute 'plotting'

  29. 29

    Python - 'module' object has no attribute 'randrange'

HotTag

Archive