Tkinter enlarging graphs drawn on canvas without changing the canvas size - python-3.x

I am currently creating a GUI which plots data points from a textfile. I would like to enlarge the graph. Would like to ask if it is possible because everything I tried seems to yield no result. Below I attached the image of the graphs which I wish to enlarge. Thanks.

Related

How can i stop grid lines appearing every time i use stroke in QGIS when exporting to SVG

I am a bit new to QGIS but having a play around with it. At the moment I am trying to export an SVG (vector) so that I can keep all the layers I have created, but every time I use a stroke on anything, like the buildings or sea, i get a grid included that cuts into the shapes (see examples attached). It doesn't seem to do this when exporting to a PDF. The PDF doesn't preserve the layers so my question is, when using a stroke, is there a way of removing the grid like shape, when exporting an SVG from QGIS?
I have tried lots of things, like, splitting up all the part of the map onto separate layers, which helped make the grid less noticeable but didn't eliminate the problem.

Getting rid of empty space in tkinter embedded matplotlib graph

I'm embedding certain graphs into my tkinter GUI, and I noticed I have a lot of "empty space" around the figure.
There are 3 frames in the picture, first containing buttons above the figure, second containing the canvas that contains the figure, and third containing the test.
I've checked the graphs by plotting them outside of TkAgg and there is minimum empty space, so I suspect something goes wrong when I call FigureCanvasTkAgg.
Is it possible to control how much a matplotlib Figure fills Canvas widget?
code below:
canvas=FigureCanvasTkAgg(figure,master=canvasframe)
widget=canvas.get_tk_widget()
widget.pack()
Found the error. Error was in adding subplots to figure, I added with:
.add_subplots(221)
instead of
.add_subplots(121)
Really really basic error.

Using tk.Scrollbar to update images in tk.canvas

I developed a small tkinter GUI to display (and export) images stored in a proprietary format. I managed to load the data into a 3D numpy uint8 array. I want to display one slice of that 3D array in a tkinter.canvas. To do so I used ImageTk.PhotoImage.
Underneath the Canvas I inserted a tk.Scrollbar. My goal is to use that scrollbar to let the user actively "scroll" though the 3D Array. Basically when the slider is moved or any of the arrows is pressed the slice corresponding to the slider position should be displayed in the canvas.
Right now I have the issue that I don't understand how to set the range of the scrollbar to my z-Dimension and then how to bind the scrollbar events to the movement or arrow actions to update the canvas.
Right now I don't have example code since this is a more conceptual problem.
Could you point me in the right direction how to solve this?
Best TMC
edit: Photo
Tkinter Gui with Canvas and Scrollbar
The solution is to use tkinter.Scale instead of tkinter.Scrollbar . As a side note, the command within:
scale = tk.Scale(yourTkFrame, from_=min, to=max, orient='horizontal', command=doSomething)
passes two values to the function doSomething.
Using the Scale allows to use the scale.get() method to retrieve the position between min and max values. Those can then be used to set the image corresponding to the selected position on the slide.

Making a drawing game using phaser

I am developing a game using Phaser where a user is rendered a triangular canvas. User can crop this canvas to any possible shape by drawing any crop pattern on the canvas. Besides this, i need to get this cropped canvas in suitable data format to be used as an image to render and also trace changes made on this canvas for undoing puspose.
Any help to get this through will be appreciated.
Thanks in advance.
Initial canvas
Canvas after crop
Cropped canvas used to create new canvas
So it's like folding a piece of paper and then cutting it so it looks like a snowflake? Interesting idea.
I think you could either use BitmapData to draw the initial cut out, then copy that bitmap 6 (or 12?) times and rotate and flip x-axis to construct the rest. Though maybe there will be seems, so like small lines, between the parts idk.
Another appproach would be to keep track of the initial cutlines like vectors. Then use math/trigonometry to calculate the result. No idea how to do this though, sorry.

Why is duplicate text being rendered onto the Z buffer of a different texture when using D3DXFont::DrawText?

I've been stumbling over this for a while and was wondering if anyone has run into this problem before.
The application I'm working on is divided into multiple data plots and a single timeline at the bottom of the screen. Each plot (which is actually multiple textures layered on top of each other) as well as the timeline is rendered to a separate texture. The timeline texture is rendered first, followed by each of the plot textures from the top of the screen to the bottom. I am using DXUT and DirectX9 (March 2009).
After adding time text to the timeline texture, I noticed that the text was repeated in the title bar of every data plot. Here's a screencap of a portion of the display, it shows just a single plot, but the text repeats on every plot opened:
It seems like it is tied directly to the DrawText being called in the timeline's render function. I do use relative coordinates as the rect being passed to DrawText, but since I've already set the render target to the desired texture it should only affect the current texture. Not every texture rendered afterward.
Has anyone ever run into any problems similar to this using D3DXFont?
EDIT: After some more experimentation, it looks like it has something to do with the Z buffer. By adding D3DCLEAR_ZBUFFER to the clear on each texture surface, the duplicate text is gone. While the problem seems bypassed for now, I'm still curious as to why the Z buffer for a completely separate texture was being written during my DrawText call.
The Z Buffer state is persistent.
For example,
SetDepthStencilSurface(X)
SetRenderTarget(A)
Draw()
SetRenderTarget(B)
Draw()
Both Draw calls will use the same depth buffer.
The DrawText is not changing the depth buffer that you have set. It assumes you meant to do what you did.

Resources