How to add a Matplotlib Graph to Tkinter Window in Python 3 - Tkinter tutorial Python 3.4 p. 6

Поделиться
HTML-код
  • Опубликовано: 22 авг 2024

Комментарии • 232

  • @novicetech1
    @novicetech1 6 лет назад +73

    'canvas.show' was deprecated in version 2.2. Message says to use 'canvas.draw' instead. Worked for me but the navigation icons are not in color as on your screen.

    • @veganath
      @veganath 5 лет назад +4

      *_canvas.draw()_* thanks saved me some grief...

    • @robertpanzer7164
      @robertpanzer7164 5 лет назад +5

      Thanks for this! I was about to give up on matplotlib.

    • @TheEngineeringToolboxChannel
      @TheEngineeringToolboxChannel 5 лет назад

      I had this issue...no errors now but the graph isnt plotting!

    • @JohnCena963852
      @JohnCena963852 5 лет назад

      Thank you sir.

    • @tanvirahamed8555
      @tanvirahamed8555 5 лет назад +4

      This time I did not surf in the internet. I straight came to the comments.... Thanks a lot!!

  • @cntrlengr
    @cntrlengr 3 года назад +5

    Using Python 3.9...I had to change the line "from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg, NavigationToolbar2TkAgg)" to "...NavigationToolbar2Tk)" and I needed to remove the canvas.show in the PageThree class. But it seems to work great now! Great tutorial!

    • @anroh1
      @anroh1 2 года назад +1

      thank you so much Paul i had this problem too this helped!!

    • @abhilashtalankar3952
      @abhilashtalankar3952 2 года назад +2

      Thanks man i was having trouble

    • @grispaez3745
      @grispaez3745 2 года назад +1

      Muchas gracias!!! Tenia el mismo problema :)

    • @joseluizdurigon8893
      @joseluizdurigon8893 Год назад +1

      I manage to figure out by myself that ("from matplotlib.backends.backend_tkagg import (FigureCanvasTkAgg, NavigationToolbar2TkAgg)" to "...NavigationToolbar2Tk)") but i doubt that only by removing the canvas.show() would solve the problem!! Hahahahaha, thank you, sir!!

    • @srprime7596
      @srprime7596 Год назад +1

      thanks this helped me

  • @jhonya.zavaleta6736
    @jhonya.zavaleta6736 4 года назад +15

    14:55
    -"Why am I failing?"
    I relate to this on a spiritual level

  • @charlvantonder5247
    @charlvantonder5247 6 месяцев назад +1

    Thanks for these tutorials. Ive been battling for weeks trying to find the answer to switching frames for my menu window.
    I agree, online content is limited. And have found that ChatGPT isnt that smart as it cant reason.
    Thanks again, finally I can make ptogress! Will be checking the rest after I redisgned my menu.

  • @Ashley-sd5xn
    @Ashley-sd5xn 9 лет назад

    To anybody having trouble with this make sure you use pip and install everything that it says you're missing. Ex cmd: "pip install six" will install the module "six". If you have problems with NumPy, google Visual C++ 9.0 for python and install it. Then run on the command line "python -m pip install numpy".
    Spent hours working on this and finally got it to work after this.

  • @senixahaa
    @senixahaa 8 лет назад +4

    I loved the struggle, such the real experience of programming

  • @priteshpawar9807
    @priteshpawar9807 5 лет назад +10

    NavigationToolbar2Tk use this
    instead of NavigationToolbar2TkAgg

  • @rijhumal3381
    @rijhumal3381 7 лет назад

    whenever i stuck in any problem i follow your tutorials and get solution .

  • @704patrat
    @704patrat 8 лет назад +12

    I had a lot of trouble because I'm using Anaconda(if you are having trouble before this some googling should solve this quickly).I am using Visual Studio and python 3.5. The way to get this working in Visual Studio is to go to View\Other Windows\Python Environments, in whichever Anaconda and Python version you are using, go to pip and uninstall both pillow and matplotlib. You then use pip to reinstall (pillow then matplotlib) and everything should be fine. If you are not using Visual Studio then you need to need to uninstall the same programs as I just mentioned. I believe it is a known bug and Anaconda is trying to fix it.

    • @RSRA1977
      @RSRA1977 8 лет назад +2

      +Mr. Buffoonery Thanks so much for the tip, I just followed your advice and it fixed the problem!

    • @CharunThattai
      @CharunThattai 8 лет назад +2

      +Mr. Buffoonery Awesome.. Thanks.. I had the same issue and spent hours trying to fix it..

    • @user-lw2wr6yy1i
      @user-lw2wr6yy1i 8 лет назад +2

      +Mr. Buffoonery Thank you. This got it to work for me.

    • @att0805
      @att0805 7 лет назад +1

      Thanks, man saved me a good few hours (or days even!) too. These comments are really appreciated.

    • @scottn2243
      @scottn2243 7 лет назад

      Thanks. It works now.

  • @gretagraeler6781
    @gretagraeler6781 2 года назад +3

    On my Python version, 3.9.7, it did not like the "NavigationToolbar2TkAgg". Instead, it accepted "NavigationToolbar2Tk". Just a heads up if anyone now is having the same problem

  • @ablakey3814
    @ablakey3814 8 лет назад

    Hi there sentdex! firstly, I'd like to echo the positive comments for covering this subject - it's a great help! Secondly, I'm following this example on my raspberry pi and have encountered the following error message specific to the use of matplotlib:"ImportError: cannot import name '_tkagg'"The area of code it refers to is in the import lines of code: "from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg"I've got all the code typed as per your example and the pi is fully up to date. Any ideas would be great fully received!Again, the lessons are great and a good source of knowledge!

  • @pasindusamaranayake9672
    @pasindusamaranayake9672 4 года назад +2

    Using any button on the toolbar gives this: AttributeError: 'FigureCanvasTkAgg' object has no attribute 'manager'

  • @GibsnRage
    @GibsnRage 8 лет назад +6

    Attempting to install matplotlib. That's 3 hours of my life I will never get back.

    • @GibsnRage
      @GibsnRage 8 лет назад

      +GibsnRage only to discover.. I have python installed as 32-bit.. Seems best I just start fresh installing this huge library of dependencies.. ;_;

    • @Keamybakunin
      @Keamybakunin 6 лет назад

      Lol.

  • @matthias1637
    @matthias1637 9 лет назад +1

    Awesome series!
    Pls make sure, to continue to the end ans if possible upload the videos more frequently.

  • @vladdumitrescu5942
    @vladdumitrescu5942 9 лет назад +2

    I've been watching your tutorials with great interest so far (thank you for your work btw).
    But there is something that has always bothered me and didn't manage to find anything about it on the net mainly: Why is """self""" the second argument in some of your instances of module classes?
    Shouldn't it be the first argument as a convention?
    In which situation does it appear as a second parameter?
    I tried switching the positions but got errors so a little help would be really appreciated in understanding this :).

    • @pedromoresco93
      @pedromoresco93 6 лет назад

      I'm not an expert but u should pay atentio to the object. In the case of the creation FigureCanvasTkAgg if u look in the documentation the arguments should be first the figure an then the master window, in this case the object-self. goo.gl/AU7tv1

  • @maximilianb.7728
    @maximilianb.7728 3 года назад +1

    Hey, thanks for that tutorial! I have a question: how can I delete or overwrite this canvas object? I want to plot the data from different csv files. It works for the first dataset, but the second dataset is plotted below the first one and also very ugly and without any interactive features. For the third dataset, nothings happens.

  • @tasnimali9312
    @tasnimali9312 7 лет назад +4

    If you get this error:
    from matplotlib.backends import _tkagg
    ImportError: DLL load failed: The specified module could not be found.
    A temporary fix is to add
    import matplotlib.pylab as pylab
    before matplotlib.use("TkAgg")

    •  7 лет назад +1

      Yup, that did the trick! thank you so much,, and sentdex for the videos.
      can you explan why it worked tho? thx again

    • @lukemoon4466
      @lukemoon4466 6 лет назад

      Iv come here from the main website as I had an inkling there may be a solution to this problem in the 'youtube comments' thank you for the fix

  • @jnchacon
    @jnchacon 4 года назад +1

    Hi, I'm following the video (actually the playlist) and I have the following problem: when I press save, I get this error:
    master=self.canvas.manager.window,
    AttributeError: 'FigureCanvasTkAgg' object has no attribute 'manager'
    Can you help me to solve it?

  • @gscore420
    @gscore420 8 лет назад

    tkinter has a built in task scheduler that allows u to use the mainloop of the program to preform updates to the gui

  • @DaniloSouzaMoraes
    @DaniloSouzaMoraes 7 лет назад +1

    instead of adding classes to frames list it would be nice to make that dynamic by inspecting sys.modules or globals() and selecting classes that endwith "Page" or something like that.

  • @mathsk1081
    @mathsk1081 6 лет назад +1

    how could I use grid in this example especially for the plot and the toolbar?

  • @johnf4275
    @johnf4275 4 года назад

    I am following along in the tutorial and am wondering if this app can be made to be open ended to grab a variety of live data sets, such as Corona virus stats etc?

  • @rushu2022
    @rushu2022 8 лет назад +3

    Hello, I took your lessons on Tkinter and Python and tried to run the same code from the tutorials with the simple graph from matplotlib (teh exact same code in the above video). But when I run the program I get this error tried to search on google but could not find anything. The error says "Process finished with exit code -1073741819 (0xC0000005)" Please help.

    • @kbo1966
      @kbo1966 7 лет назад

      Try reinstalling matplotlib

  • @Mike-yf1lj
    @Mike-yf1lj 9 лет назад

    Thank you for the tutorials. I was wondering if you know of a way that you can select a region on the plot, and when you select that region, store the x and y boundaries of the selected region. For example, on your plot your x axis goes from 1 - 8 and your y axis goes from 1 - 9. If you selected the region x[4:7] and y[2:6], then the values x1=4, x2=7, y1=2, and y2=6 are stored, and can be used else where in the program.

  • @mascai
    @mascai 5 лет назад

    The best python tutorials!

  • @mattm7482
    @mattm7482 5 лет назад +1

    Hello, what is the controller "go to page" function?

  • @hakansjoberg4965
    @hakansjoberg4965 7 лет назад

    Excellent tutorial as always! I have a question regarding if it's the normal way i python to have all the classes in the same file (Yes, i'm from the Java-family)?

  • @podcastslow
    @podcastslow 7 лет назад

    NICE! But what about if you plot it into Negative axis (x and y coordinates) ? The plotmatlib origin only shows positive axis of x and y from (0,0) ...

  • @tearlachhorn
    @tearlachhorn 7 лет назад

    In tkinter you can refresh frames by changing values of some functions

  • @ztrading16
    @ztrading16 5 лет назад +1

    Hello ! i am working on my professional project . I am creating a tkinter GUI which consist of importing data and ploting graphs on it like histogrms, QQ and PP plots. Could someone help me

  • @prateekagrawal13
    @prateekagrawal13 9 лет назад

    As others I am also getting Tcl:error, while using Anaconda, I want to ask rather than using TkAgg as backend can I use Qt4Agg as backend and solve the above problem. I am pretty young in python world and if not a tutorial video some demo code or some documentation how to do it, would be pretty helpful for me. thanks in advance

  • @vegardpig8634
    @vegardpig8634 4 года назад

    Is it possible to instead add background images and entry fields in this code? If so i don't know how and i would like to do it.

  • @abhilashtalankar3952
    @abhilashtalankar3952 2 года назад +1

    16:00 haha that was very natural

  • @00thorn
    @00thorn 8 лет назад +1

    Hey Sentdex thanks for a good tutorial, I've been adapting your code to create a live serial plotter from an arduino any tips/links you can share to make this run smoothly?

  • @paridhimathur537
    @paridhimathur537 6 лет назад

    I have a data frame which gets created when a file is chose by the user. I am trying to output that data frame on a tkinter window but I am not able to do it. Is there anyway to do that?
    Thanks to your video I can show the plots on the Tkinter window but not that data frame. Any help will be appreciated. Thank you so much.

  • @JurinoH
    @JurinoH Год назад

    Hi sentdex, how can i change color of graph or set background graph transparent or dark mode. Thank you

  • @VCAM
    @VCAM 7 лет назад

    Not sure why my Matplotlib toolbar is bare bones black and white but yours on the tutorial is got some colors. Could it be the style that's being assigned?

  • @alkane9671
    @alkane9671 3 года назад

    Great tutorial! How can I add a title and axis labels to the graph?

  • @noahsalas6854
    @noahsalas6854 5 лет назад

    Are there conflicts using grid and toolbar instead of pack?

  • @Marvin34565
    @Marvin34565 5 лет назад

    What's the difference between get_tk_widget() and _tkcanvas at 13:30 and why do you even call up "canvas." twice?
    Seems to work for me either way, was expecting an error somewhere when trying to switch these around...

  • @sharinaledrus6692
    @sharinaledrus6692 9 лет назад

    Hi.. Instead of using the pack method, how do i go about using the grid method? I've been giving it a try and have no problems with e buttons. But the matplotlib graph won't display.

  • @mauritsdogterom5907
    @mauritsdogterom5907 4 года назад +1

    I got the ImportError: 'Cannot load backend 'TkAgg' which requires the 'tk' interactive framework, as 'qt5' is currently running' if I call matplotlib.use('TkAgg'). The backend TkAgg cannot be found or something. Any idea how to fix this?

    • @SudhirSasane
      @SudhirSasane 4 года назад

      I am getting same error . May I know how did you fix it ??

    • @fpostgate
      @fpostgate 4 года назад

      Get same, I have Anaconda installed with Python 3.7.6 matplotlib 3.1.3, some folks are describing "NavigationToolbar2TkAgg is deprecated. Use NavigationToolbar2Tk instead" Does that have anything to do with the error? I am a real newbie, I just converted one of my Matlab simulations to python witch works great, I just can't figure out the GUI.

  • @BikashDebnath
    @BikashDebnath 8 лет назад +3

    Hi Harison, I am using Spyder(Anaconda package, Python 3.5) to run your tutorial. It works fine, untill I add the canvas show part. Then I get this "it seems the kernel died unexpectedly. Use 'Restart kernel' to continue using this console.". Can you please help.

    • @rolandblok
      @rolandblok 8 лет назад +1

      +Bikash Debnath i have exactly the same probelm. Python crashes on show function...

    • @BikashDebnath
      @BikashDebnath 8 лет назад +1

      +Roland Blok
      Hi Roland, I didn't waste time anymore with Spyder, rather started with WinPython plain simple and very easy to use. I would recommend try using WinPython.

    • @rolandblok
      @rolandblok 8 лет назад

      +Bikash Debnath tnx. That actually works.

    • @user-lw2wr6yy1i
      @user-lw2wr6yy1i 8 лет назад +1

      +Bikash Debnath See Mr Bufoonery's comment below.

  • @mohamedasma8949
    @mohamedasma8949 3 года назад

    hi so how can i upload a geodatabase to read it and show it and apply tools in it in my gui

  • @giorgibakuradze
    @giorgibakuradze 5 лет назад

    Hello, is it possible to get the data analysis information in the entry widget with tkinter?

  • @batlilemphahlele9532
    @batlilemphahlele9532 7 лет назад

    ok I get that but then how do you create the same graph you created using information from the user input

  • @sharinaledrus6692
    @sharinaledrus6692 9 лет назад

    great tutorials!! keep up the good work..
    I have a question though, Instead of a Matplotlib graph, how to add or display an Image to the Tinter GUI?

    • @sentdex
      @sentdex  9 лет назад

      Here's a basic example of images:
      pythonprogramming.net/tkinter-adding-text-images/

  • @zaironjacobs
    @zaironjacobs 7 лет назад

    How do I put strings instead of numbers at the x values, it won't accept string.

  • @Daniel-nh4oq
    @Daniel-nh4oq 6 лет назад

    How can I change the size of the GUI on all of the pages, without the graph as I want to make a login page with numerous pages?

  • @tearlachhorn
    @tearlachhorn 7 лет назад +1

    tkagg seems to not be working in windows 10

  • @forus6813
    @forus6813 4 года назад

    line 107, in __init__
    canvas.show()
    AttributeError: 'FigureCanvasTkAgg' object has no attribute 'show'
    apakah canvas.show diabaikan saja?
    jika diabaikan, maka program dapat berjalan

  • @henrywang4361
    @henrywang4361 4 года назад

    can I change the background image of the graph?

  • @wlancer8826
    @wlancer8826 6 лет назад

    Does anyone else finds the graph moving up a bit and got a bit cutoff on the top when navigating to some other pages and then clicking back to the graph page?

  • @Diego4322237
    @Diego4322237 7 лет назад

    Mil gracias amigo..tu vídeo es genial!

  • @TheMrGuevara
    @TheMrGuevara 5 лет назад

    AttributeError: 'FigureCanvasTkAgg' object has no attribute 'manager' when using the Toolbar. How can we use e.g. the 'save' Button?

  • @vivekjain4989
    @vivekjain4989 7 лет назад

    I want to add graph to a pdf . I am using Anaconda Navigator and reportlab module to make pdf and in that i want to add graph

  • @statixsc3013
    @statixsc3013 9 лет назад

    i may be having same issue except when ig et the 64 bit installer it tells me i dont have pythin 3.4 installed . .when i do

  • @chemicznybrat
    @chemicznybrat 6 лет назад

    Hi Sentdex, Can you tell, how to change axis spacing to 'log' in tk-integrated plots ?

  • @poojabhalode11
    @poojabhalode11 7 лет назад

    Hi sentdex, Can you please give me some steps on upgrading my matplotlib, I have a 1.3 version and running into errors when I try to install 2.0.0. I am working on Mac 10.12. Please let me know. I would really appreciate it.
    Thankyou

  • @invsiblshowercurtain
    @invsiblshowercurtain 8 лет назад +1

    I'm not yet sure why this is happening, but I could not make the toolbar appear using your original code. I had to call canvas.get_tk_widget().pack() after making the toolbar. When I do that everything works as expected. canvas._tkcanvas.pack() doesn't seem to work although maybe the toolbar is being put behind the figure. I am using matplotlib 1.5.0 and python 3.5.

    • @chr1sAsh
      @chr1sAsh 8 лет назад

      yes thanks for this. I had the same problem :)

    • @ArthurVarkentin
      @ArthurVarkentin 5 лет назад

      It seems, there were changes in the usage. For the recent version of all packages the following worked for me to put the navigation bar on top:
      canvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH, expand=True)
      for canvas and
      toolbar.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
      for the toolbar part.

  • @poojabhalode11
    @poojabhalode11 7 лет назад

    Hi sentdex, I was wondering if you could tell me how to convert this into python 2.7?

  • @jaspervandenbrande
    @jaspervandenbrande 3 года назад

    I know this video is 6 years old, but here goes nothing.
    Is there anyone who can tell me how I can add 2 graphs in one figure. To specify I want to be able to plot a quadratic equation, and the y=0 line to solve quadratic equations visually.
    How would I add these two plots to 1 figure so they share x and y axis?

  • @RohitSingh-gu6jh
    @RohitSingh-gu6jh 5 лет назад

    This program shows me this error 'matplotlib' is not defined, could you help me

  • @khalidvlogger
    @khalidvlogger 4 года назад

    thanks for this amazing video bro

  • @SudhirSasane
    @SudhirSasane 4 года назад

    @sentdex I am using spyder IDE from Anaconda envirmont. I am getting following error :-> " Cannot load backend 'TkAgg' which requires the 'tk' interactive framework, as 'qt5' is currently running " Can you please suggest me the solution. thanks in advance.

    • @SudhirSasane
      @SudhirSasane 4 года назад

      update : it runs without error via conda command prompt. But doesnt work with spyder builtin console.

  • @edwardrobertgarciallontop9169
    @edwardrobertgarciallontop9169 7 лет назад

    can you use Tkinter and matplotlib in Raspberry Pi, To graph signals in real-time?

  • @mammenezio6473
    @mammenezio6473 5 лет назад

    How do i add some themes to my application to make it beautiful ?Plz help!!!

  • @valmekong8801
    @valmekong8801 9 лет назад

    I have the same problem with Anaconda on Win7. TkAgg backend don't work! qt4Agg seems to work better with Matplotlib...

  • @akashshah6818
    @akashshah6818 7 лет назад

    Thanks for video. but how can I get date vs data graph here?

  • @user-jc4oi1xg1z
    @user-jc4oi1xg1z 5 лет назад +1

    Instead of show() use draw()

  • @forus6813
    @forus6813 4 года назад

    ImportError: cannot import name 'NavigationToolbar2TkAgg' from 'matplotlib.backends.backend_tkagg' (/home/recki/.local/lib/python3.8/site-packages/matplotlib/backends/backend_tkagg.py)

  • @dashchin2377
    @dashchin2377 8 лет назад

    First, you are cool thank you.
    Second, I need your help. I have CSV file which includes X, Y, Z axis and 7 elements concentrations Au, As etc. I need to visualize data like building histogram, mean, median for every element, basic statistic. I want to write code for one and automatically go from first element to the last element, like column by column. I guess I have to use for loop. But not sure. How to do this? Please help,.

  • @wlancer8826
    @wlancer8826 6 лет назад

    14:55 in 1.5x speed "NO" sounds extra cute~~

  • @Bruno_Felipe
    @Bruno_Felipe 4 года назад +1

    "I can't win today guys" it's the sentece that I more reapet when I 'm coding.

  • @ganeshkumarpatil3751
    @ganeshkumarpatil3751 4 года назад

    Is this code available on any repository please

  • @jimmiller9386
    @jimmiller9386 3 года назад

    Again, issues with Pack and Grid. I have been following along, trying to modify the code for grid() and not pack() and run into this
    _tkinter.TclError: cannot use geometry manager pack inside .!frame.!pagethree which already has slaves managed by grid
    canvas = FigureCanvasTkAgg(f, self)
    # canvas.show()
    canvas.draw()
    canvas.get_tk_widget().grid(row=2, column=0, padx=5, pady=5)
    toolbar = NavigationToolbar2Tk(canvas, self)
    toolbar.update()
    # canvas._tkcanvas.grid(row=4, column=0, padx=0, pady=0)
    So back to pack() it is.
    By the way, sorry for being a Jerk. You've put SOOOOOO much work into these. I do appreciate it.

  • @Simonnz2
    @Simonnz2 9 лет назад

    In your matplotlib tutorials you always use "import matplotlib.pyplot as plt", why are you using "from matplotlib.figure import figure"? What is the difference?

  • @novicetech1
    @novicetech1 6 лет назад

    NavigationToolbar2TkAgg works but throws and error. According to StackOverflow, Matplotlib now want NavicationToolbar2Tk with the Agg. I tried it and it runs without the error. Here's the link if interested: stackoverflow.com/questions/50330320/what-to-use-instead-of-navigationtoolbar2tkagg

  • @gerald5028
    @gerald5028 5 лет назад

    would you be so kind and paste the code in you describtion?

  • @heavyhussar9327
    @heavyhussar9327 6 лет назад

    I've banged my head for 5 hours trying to fix an issue with the backends part of matplotlib. It turns out matplotlib requires a library called PyGTK, which requires pyGobject, which requires pyCairo. I'm having this weird issue installing pyCairo in particular where it says that include file called 'cairo.h' is missing. The command prompt (I'm on Windows 10 default command prompt without using admin mode) then proceeds to spew red error text in my face. Anyone know how I get past that issue? I'm using Python 3.6 BTW.

  • @plamenpetrov8031
    @plamenpetrov8031 7 лет назад

    This is how i was able to close plot:
    def on_closing():
    quit()
    app = SeaofBTCapp()
    app.protocol("WM_DELETE_WINDOW", on_closing)
    app.mainloop()

  • @marcoslorhan8351
    @marcoslorhan8351 5 лет назад

    My Graph is a pizza Style (axl pie) so i am having problems with this, can someone help?

  • @winecheese2185
    @winecheese2185 9 лет назад

    I have windows 10 64bit laptop and i use python 3.4
    I use pycharm compiler and when i manually dl the 64bit version from site and try to install it,it says "python 3.4 not found in your system" and i try to install 32bit version it finds the python34 folder and installs it.But it doesnt work.
    Pycharm says,cant install matploplib because unable to find vcvarsall.bat.
    But i have c++ 2005,2008,2010,2012,2013
    How come there is no vcvarshall.bat ?

    • @winecheese2185
      @winecheese2185 9 лет назад

      and what does that mean:
      import numpy as np
      ImportError: No module named 'numpy'
      i tried it but there is no module as numpy i guess :/

    • @sentdex
      @sentdex  9 лет назад +1

      +Curious Guy means you need to install numpy. How to do this: pythonprogramming.net/using-pip-install-for-python-modules/

  • @Max-lr6dk
    @Max-lr6dk 4 года назад

    The graph isn't showing. Even if i use canvas.draw() and FigureCanvasTk

    • @Max-lr6dk
      @Max-lr6dk 4 года назад

      I change FigureCanvasTk by FigureCanvasTkAgg to fixed it

  • @natsagnyamnamkhai749
    @natsagnyamnamkhai749 4 года назад

    good job

  • @webaruhazberles
    @webaruhazberles 5 лет назад +1

    show() = AttributeError: 'FigureCanvasTkAgg' object has no attribute 'show'
    draw() = AttributeError: 'NoneType' object has no attribute 'update_idletasks'
    what a hack can be used?

    • @andersoncanteli
      @andersoncanteli 5 лет назад +1

      You could replace cavas.show() to canvas.draw(). It worked for me

    • @hallinhko
      @hallinhko 5 лет назад +1

      @@andersoncanteli Thank you that was very helpful

  • @jonathanbollig666
    @jonathanbollig666 4 года назад

    canvas.show() doesn't work anymore, canvas.draw() does instead.

  • @sadfool
    @sadfool 4 года назад

    Im getting an errror TclError: wrong # args: should be "wm iconbitmap window ?bitmap?"

    • @sadfool
      @sadfool 4 года назад

      Python 3.7

  • @brettnelson1592
    @brettnelson1592 5 лет назад

    I'm getting a trackback error on "from matpfrom matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg"
    I get an "ImportError: cannot import name 'NavigationToolbar2TkAgg' from 'matplotlib.backends.backend_tkagg'"
    I can't find any solution elsewhere.
    Anyone else getting the same issue?
    Import matplotlib - works
    from matplotlib import style - works

    • @brettnelson1592
      @brettnelson1592 5 лет назад +2

      WORKING CODE:
      from matpfrom matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2Tk
      instead of
      from matpfrom matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg

  • @MrAlerius1
    @MrAlerius1 8 лет назад

    If I write "canvas._tkcanvas.pack(side=tk.BOTTOM, fill=tk.BOTH, expand = True)",
    then is the toolbar on the top, but why? I think it is curious. :D

    • @der0keks
      @der0keks 8 лет назад

      +Erik.R maybe he didn't save before he tested it?

  • @laissez-faire496
    @laissez-faire496 9 лет назад +1

    #SOS please help....i get a error "matplotlib.use("TkAgg")
    AttributeError: 'module' object has no attribute 'use'
    What should i do...i've watched your attribute tutorial but i still cant find the problem...
    Thx

    • @sentdex
      @sentdex  9 лет назад

      Laissez - faire odd. Do you have anything in your directory called matplotlib?

    • @laissez-faire496
      @laissez-faire496 9 лет назад

      sentdex No i don't

    • @sentdex
      @sentdex  9 лет назад

      Laissez - faire try doing:
      import matplotlib
      print(matplotlib.__file__)
      What comes out?
      Copy and paste your full code here too, let's look at that.

    • @laissez-faire496
      @laissez-faire496 9 лет назад

      sentdex Traceback (most recent call last):
      File "", line 1, in
      print(matplotlib.__file__)
      AttributeError: 'module' object has no attribute '__file__'

    • @laissez-faire496
      @laissez-faire496 9 лет назад

      Laissez - faire but when i enter it in pycharm it gives me
      Traceback (most recent call last):
      File "C:/Users/Robert/PycharmProjects/untitled4/python configure-ng.py", line 2, in
      print(matplotlib.__file__)
      AttributeError: 'module' object has no attribute '__file__'

  • @johnbaker4612
    @johnbaker4612 9 лет назад

    I was trying to integrate your matplotlib code into my existing Python/tkinter program which uses stringvar(). My code had worked ok, buttons and labels etc, before I integrated your code but after integrating your code, stringvar() wasn't recognized and sadly I will have to look for another way to include a matplotlib graph into my code.

    • @johnbaker4612
      @johnbaker4612 9 лет назад

      John Baker I just now discovered that I don't have to use StringVar for the labels on my GUI. So I will go back to try to use your matplotlib code in my GUI.

    • @johnbaker4612
      @johnbaker4612 9 лет назад

      John Baker I can use StringVar() by including "from tkinter import *"
      1) But am getting Python crashing with the canvas.show() command. My code is a little different from the sendex code. I want everything on one page so am using an upper Frame for some data entry and data display and a second (lower) Frame for the graph. All works ok until I do the canvas.show() command. Any idea why canvas.show() crashes Python?
      2) Another problem is that I get an extra window, the tk window. My main window is named "My Window." How to get rid of the tk window?

    • @johnbaker4612
      @johnbaker4612 9 лет назад

      John Baker Now trying sendex code from
      pythonprogramming.net/how-to-embed-matplotlib-graph-tkinter-gui/
      I see it crashes Python too! Not a good sign. I'm using Anaconda, so that may be the problem.

    • @johnbaker4612
      @johnbaker4612 9 лет назад

      John Baker Ok, I got your Python/tkinter/matplotlib code to run. Apparently the problem was with Anaconda. So getting away from Anaconda, I downloaded and installed Python 32 bit version from the Python website although my PC is a 64 bit Win7. I installed the 32 bit Python because of the next install from the cs.wpi.edu website: I got and installed Matplotlib, Numpy etc from web.cs.wpi.edu/~cs1004/a14/Resources/. Then I had another problem with the font cache which I solved with info from askubuntu.com/questions/578129/plotting-with-matplotlib-in-python-3-pylab-tkinter-and-qt-fontmanager-errors, although I'm using Win7. Then finally I was able to get my own code running to show your simple graph but the graph shows up in the xtra tk window, and I really want it to show in the lower Frame in my code. So I have more work to do but it looks much more promising. Hopefully this info will be helpful to others.

    • @johnbaker4612
      @johnbaker4612 9 лет назад

      John Baker Got my code all working, a little different from Sentdex's in that my GUI with graph is all on a single page. Check out my blog at johnbakeree.blogspot.com/
      Thanks Sentdex!

  • @MackiurDomii
    @MackiurDomii 7 лет назад

    why my icons are black =(

  • @alexhighland6805
    @alexhighland6805 8 лет назад

    HELP!
    My Python comes up with an error when I type "from matplotlib import styles" !:
    Traceback (most recent call last):
    File "", line 1, in
    from matplotlib import styles
    ImportError: cannot import name 'styles'
    Please Help Me!

    • @sentdex
      @sentdex  8 лет назад

      +Alex Highland it's not styles, it's just style, singular.

    • @alexhighland6805
      @alexhighland6805 8 лет назад

      +sentdex Thank you so much!

    • @alexhighland6805
      @alexhighland6805 8 лет назад

      Thanks for this! You're so kind to do this tutorial for anyone to ask; no charge! Thank you so much! I've been going around the internet for ages reinstalling and uninstalling modules. I'm such an idiot! You've made my day! :D

    • @training_demo
      @training_demo 7 лет назад

      Hello Sir.....

  • @kahisawheel
    @kahisawheel 9 лет назад

    Awesome!

  • @alperenalperen2458
    @alperenalperen2458 4 года назад

    Would you look at that! That's exactly what I need :D

  • @nicholasjohnson5321
    @nicholasjohnson5321 9 лет назад

    Following along, at the end of this video the code wont run. The TclError error I get points (literally with a -->) to the line of code that says canvas.show() after not being able to figure it out what typo I must have I borrowed your written code from pythonprogramming.net, and it throws the same error. The error also points to some lines in draw() from backend_tkagg.py and blit() from tkagg.py I'm using python 3.4.1 from anaconda, Any idea whats wrong with my interpreter?

    • @sentdex
      @sentdex  9 лет назад

      I am guessing the problem is with anaconda having their own "versions" of matplotlib and maybe some different locations of matplotlib and the necessary file.
      Try using just a straight python 3.4 IDLE. You should be able to have both on your computer. You might also contact them or maybe search to see if others have had this issue when changing the backend of matplotlib's canvas.

    • @nicholasjohnson5321
      @nicholasjohnson5321 9 лет назад

      Couldn't find other people with similar issues, I'm sure because the error is to vague. I installed 3.4 IDLE to try a clean version but ran out of time before installing matplotlib, hopefully then it works, though it seams troubling that such a popular/common package like anaconda would have something broken which is, I perhaps wrongly think, a pretty common use of matplotlib.

    • @sentdex
      @sentdex  9 лет назад

      Nicholas Johnson I've never been a fan of having custom installations of python for this very reason. This specific problem is likely very uncommon, but the conglomeration of problems and minor differences between having a custom environment versus the default is pretty common.

    • @wouterdroog4210
      @wouterdroog4210 9 лет назад

      Got the exact same error as Nicholas and I'm also using python 3.4.1 from anaconda.

    • @OhmTrivedi
      @OhmTrivedi 9 лет назад

      sentdex Getting the same error! Any solution?

  •  7 лет назад

    i have a question, how do i put the toolbar on the top? lol jk
    Great videos!

  • @adamfatyga7977
    @adamfatyga7977 9 лет назад

    As always i have problems
    "AttributeError: 'NavigationToolbar2TkAgg' object has no attribute 'upadte' "
    my code:
    toolbar = NavigationToolbar2TkAgg(canvas, self)
    toolbar.upadte()

    • @sentdex
      @sentdex  9 лет назад +2

      Adam Fatyga
      What is: toolbar.upadte()? This is a typo.

  • @user-jc4oi1xg1z
    @user-jc4oi1xg1z 5 лет назад

    AttributeError: 'FigureCanvasTkAgg' object has no attribute 'show'

    • @sammathew243
      @sammathew243 4 года назад +1

      use canvas.draw() instead of the show() command that is used in the video.