Python Forum
Search Results
Post Author Forum Replies Views Posted [asc]
    Thread: Convert nested sample json api data into csv in python
Post: RE: Convert nested sample json api data into csv i...

I tried doing that. While it does produce a csv file, it is not a nicely organized file.
deanhystad General Coding Help 3 126 May-21-2022, 01:30 PM
    Thread: Convert nested sample json api data into csv in python
Post: RE: Convert nested sample json api data into csv i...

I am having a difficult time seeing how the information would be organized in a csv. There are no rows or columns. What do you expect the CSV file to look like?
deanhystad General Coding Help 3 126 May-21-2022, 02:36 AM
    Thread: rotating image with Tkinter
Post: RE: rotating image with Tkinter

Do you have any idea why your program didn't work? I cleaned up your program a little and ran it.. import tkinter as tk image_files = [ "dice1.png", "dice2.png", "dice3.png", "dice4....
deanhystad General Coding Help 6 202 May-20-2022, 08:03 PM
    Thread: How to avoid the extra set of y-axis labels?
Post: RE: How to avoid the extra set of y-axis labels?

If you have a function or method, like twinx, it gets called each time the function/method name is followed by (). The only time this is not true (that I can think of) is when making a lambda express...
deanhystad General Coding Help 9 304 May-17-2022, 04:21 PM
    Thread: How to instantly update the plot by getting values from a Scale widget?
Post: RE: How to instantly update the plot by getting va...

Quote:I didn't understand what is the usage of set_array(x,y) In the animation demo, and my subsequent reuse of that code, set_array(x, y) changes the data displayed in the plot. This code change the...
deanhystad GUI 20 574 May-17-2022, 03:52 PM
    Thread: How to avoid the extra set of y-axis labels?
Post: RE: How to avoid the extra set of y-axis labels?

This creates two subplots. It returns a figure and an axes array. fig, axs = plt.subplots(2,1)axs[0] are the axes for the first subplot. axs[1] are the axes for the second subplot. This is creating...
deanhystad General Coding Help 9 304 May-17-2022, 03:31 PM
    Thread: Populating an array dynamically
Post: RE: Populating an array dynamically

Pandas. It has something called a Dataframe that works very well with columnar data.
deanhystad General Coding Help 1 162 May-17-2022, 11:24 AM
    Thread: How to instantly update the plot by getting values from a Scale widget?
Post: RE: How to instantly update the plot by getting va...

I reworked the colormesh animation I mentioned above to use a scale object in a tkinter window. import numpy as np from matplotlib import pyplot as plt, animation import tkinter as tk plt.rcParams["f...
deanhystad GUI 20 574 May-17-2022, 12:24 AM
    Thread: How to instantly update the plot by getting values from a Scale widget?
Post: RE: How to instantly update the plot by getting va...

I never use colormesh, so I'm not familiar with it. I did find something about animating a colormesh. https://www.tutorialspoint.com/how-to-an...matplotlib My guess for scaling a colormesh is you d...
deanhystad GUI 20 574 May-16-2022, 09:22 PM
    Thread: How to instantly update the plot by getting values from a Scale widget?
Post: RE: How to instantly update the plot by getting va...

My earlier post mentioned having a method named "scale_plot" that rescaled the plot. At that time I thought that drawing the initial plot and drawing the rescaled plot would be the same. Now I think ...
deanhystad GUI 20 574 May-16-2022, 08:38 PM
    Thread: break out of for loop?
Post: RE: break out of for loop?

Could you please explain the logic you are trying to implement.
deanhystad General Coding Help 3 264 May-16-2022, 08:19 PM
    Thread: How to avoid the extra set of y-axis labels?
Post: RE: How to avoid the extra set of y-axis labels?

twinx() is a function that creates an additional axis. Each time you call it it makes a new axis. In the working code twinx() is called once, to create one additional axis. You called twinx() multi...
deanhystad General Coding Help 9 304 May-16-2022, 08:15 PM
    Thread: How to instantly update the plot by getting values from a Scale widget?
Post: RE: How to instantly update the plot by getting va...

I'm beginning to think that everything we've said is wrong. You do not want to replot the data each time you move the slider because this will quickly result in hundreds off plots. Instead you want ...
deanhystad GUI 20 574 May-16-2022, 08:10 PM
    Thread: How to avoid the extra set of y-axis labels?
Post: RE: How to avoid the extra set of y-axis labels?

twinx() creates a new axis. Your code creates two many new axis because you call twinx() multiple times. You should do something like this: y2 = axs[0].twinx() y2.set_ylabel('SPX Price')I like the "...
deanhystad General Coding Help 9 304 May-16-2022, 07:24 PM
    Thread: listbox selection
Post: RE: listbox selection

Did you try running it? Fixed config/configure so you can set other options after creating the widget. import tkinter as tk class OrderedListbox(tk.Listbox): """A list box that moves unselected ...
deanhystad GUI 4 174 May-16-2022, 06:12 PM
    Thread: How to instantly update the plot by getting values from a Scale widget?
Post: RE: How to instantly update the plot by getting va...

The plot function/method will need to know enough to draw the plot. It is likely this will require the plot function be a method of whatever class has access to the plot data. I am going to call thi...
deanhystad GUI 20 574 May-16-2022, 05:55 PM
    Thread: listbox selection
Post: RE: listbox selection

The info is not sorted, it is just generated fresh each time you call curselection(). The listbox has no memory of selection order, only what is selected. If selection order is important, you will n...
deanhystad GUI 4 174 May-16-2022, 05:14 PM
    Thread: How to instantly update the plot by getting values from a Scale widget?
Post: RE: How to instantly update the plot by getting va...

Write a function (or method) to do the plotting. Call the function/method from from openwindow() and update(). Never have duplicate code.
deanhystad GUI 20 574 May-16-2022, 03:59 PM
    Thread: How to instantly update the plot by getting values from a Scale widget?
Post: RE: How to instantly update the plot by getting va...

It is the same solution. Look at how the slider command is set to call a function. Change the function from updating a label to one that updates your plot.
deanhystad GUI 20 574 May-16-2022, 12:35 PM
    Thread: Problem with my pong game code
Post: RE: Problem with my pong game code

Works fine for me. You will want to write a paddle_a_down() function and bind it to a different key. You might also want to modify the up and down functions to prevent the paddle from moving outside...
deanhystad General Coding Help 8 1,477 May-15-2022, 06:40 AM

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020