Go to advanced search

by Inkblot
Fri Jul 31, 2020 8:05 pm
Forum: Graphics programming
Topic: Pi3D - Embedding Display in Tkinter Window
Replies: 19
Views: 1102

Re: Pi3D - Embedding Display in Tkinter Window

I think a warning and then the attribute error is a bit overkill, how about a custom exception/assertion that signifies the warning? Similar to the single instance display assertion.
by Inkblot
Thu Jul 30, 2020 11:38 am
Forum: Graphics programming
Topic: Pi3D - Embedding Display in Tkinter Window
Replies: 19
Views: 1102

Re: Pi3D - Embedding Display in Tkinter Window

Wow this is really embarrassing ... :lol: throughout all that testing yesterday I didn't notice that I was creating the sphere before the display ... silly me. I can now confirm that after removing my changes I can still close the display properly. However, just like before trying to reopen a displa...
by Inkblot
Wed Jul 29, 2020 4:23 pm
Forum: Graphics programming
Topic: Pi3D - Embedding Display in Tkinter Window
Replies: 19
Views: 1102

Re: Pi3D - Embedding Display in Tkinter Window

Output from the terminal command is 'wayland' (I have tried both using the destroy method and clicking the x button) I've tried to clone the repository and checkout the develop branch again (git clone ... then git checkout develop) and my code is: import sys sys.path.insert(1, '/home/user/Desktop/pi...
by Inkblot
Wed Jul 29, 2020 1:35 pm
Forum: Graphics programming
Topic: Pi3D - Embedding Display in Tkinter Window
Replies: 19
Views: 1102

Re: Pi3D - Embedding Display in Tkinter Window

I started to add print statements and none showed up and so decided to put one as the first line of the destroy method - it wasn't printed either. I looked around the code and saw a lot of x11 talk and literally just remembered that my Ubuntu version (18.04) uses gdm instead of x11 - could that poss...
by Inkblot
Tue Jul 28, 2020 9:19 pm
Forum: Graphics programming
Topic: Pi3D - Embedding Display in Tkinter Window
Replies: 19
Views: 1102

Re: Pi3D - Embedding Display in Tkinter Window

Hi paddy, Just cloned the repository and still the same issue ... I'm just not sure why the window won't close whether it be programmatically or using the 'x' button The tkinter canvas I can simply close by calling destroy() and it removes the canvas Perhaps there is a way to get the pi3d process pi...
by Inkblot
Mon Jul 27, 2020 6:51 pm
Forum: Graphics programming
Topic: Pi3D - Embedding Display in Tkinter Window
Replies: 19
Views: 1102

Re: Pi3D - Embedding Display in Tkinter Window

*Bump*

Just checking in ... but I should also add that calling DISPLAY.destroy(), DISPLAY.stop(), setting DISPLAY.loop_running to False all do not actually close the pi3d window. I would like to close the window but keep the program alive if possible
by Inkblot
Wed Jul 01, 2020 8:46 pm
Forum: Graphics programming
Topic: Pi3D - Embedding Display in Tkinter Window
Replies: 19
Views: 1102

Re: Pi3D - Embedding Display in Tkinter Window

Thanks again paddy, I'll be here waiting for a response ;) in the meantime, I'll see if I can optimise my end a bit to reduce cpu usage
by Inkblot
Wed Jul 01, 2020 3:24 pm
Forum: Graphics programming
Topic: Pi3D - Embedding Display in Tkinter Window
Replies: 19
Views: 1102

Re: Pi3D - Embedding Display in Tkinter Window

@paddyg Great! So I've had a little play around and I can confirm the solution does work. I just need to setup the scene and then do all input reading via tkinter and then run the appropriate functions to alter the scene. Only issue is that the inputs are a little slow but for now it's perfectly fin...
by Inkblot
Wed Jul 01, 2020 2:11 pm
Forum: Graphics programming
Topic: Pi3D - Embedding Display in Tkinter Window
Replies: 19
Views: 1102

Re: Pi3D - Embedding Display in Tkinter Window

Hi @paddyg I think you're onto something here with those demos In the demos, the 'embedding' is just taking a screenshot and pasting it into the GUI toolkit so I tried the same with tkinter: from tkinter import Tk, Canvas import pi3d from PIL import ImageTk, Image class TkWin(Tk): def __init__(self,...
by Inkblot
Fri Jun 26, 2020 6:28 pm
Forum: Graphics programming
Topic: Pi3D - Embedding Display in Tkinter Window
Replies: 19
Views: 1102

Re: Pi3D - Embedding Display in Tkinter Window

Just an update on some issues I've run into I'm trying to read mouse inputs from the Pi3D window but have run into some difficulties. Assuming a mouse attribute inside in a class: def loop(self): mx, my = self.mouse.position() self.mouse_clicked(self.mouse.button_status(), mx, my) def mouse_clicked(...
by Inkblot
Tue Jun 23, 2020 9:04 pm
Forum: Graphics programming
Topic: Pi3D - Embedding Display in Tkinter Window
Replies: 19
Views: 1102

Pi3D - Embedding Display in Tkinter Window

I'm trying to place a Pi3d Display in a tkinter Frame Looking over the source code, I can see that the TkWin class inherits from Tk so I could (in theory) use: from pi3D import Display from tkinter import Tk def config(parent, win): win.overrideredirect(True) win.transient(parent) def run(): disp.lo...
by Inkblot
Sat Oct 27, 2018 9:18 pm
Forum: Python
Topic: Pausing a Pi3D simulation?
Replies: 21
Views: 2485

Re: Pausing a Pi3D simulation?

I think I'm more concerned with actually showcasing planetary orbits first rather than running it for long periods of time. Although, that will most likely be a challenge I take on in the near future. The Orbit.py program doesn't show all of the planets and is not to any sort of scale. I'm not sure ...
by Inkblot
Sat Oct 27, 2018 4:55 pm
Forum: Python
Topic: Pausing a Pi3D simulation?
Replies: 21
Views: 2485

Re: Pausing a Pi3D simulation?

Hmm, so it seems that Newton's Law of Gravitation is not enough on its own to produce elliptical orbits. I will need to take a long look at that webpage...
by Inkblot
Sat Oct 27, 2018 11:46 am
Forum: Python
Topic: Pausing a Pi3D simulation?
Replies: 21
Views: 2485

Re: Pausing a Pi3D simulation?

Alright, I think this has set me in the right direction. Previously I had tried to create my own scale (by eye) and then used Kepler's Third Law to test whether each planet output similar values for G and continued adjusting from there. Another of my (unusual) ideas was to create a variable value of...
by Inkblot
Fri Oct 26, 2018 7:04 pm
Forum: Python
Topic: Pausing a Pi3D simulation?
Replies: 21
Views: 2485

Re: Pausing a Pi3D simulation?

Simple ellipses is more than enough for me. Only problem I have is the scaling down of the astronomical values, my current system produces inner-planetary orbits which are somewhat accurate but the outer planets basically move off in a straight line. The force of attraction for the outer planets are...
by Inkblot
Fri Oct 26, 2018 5:11 pm
Forum: Python
Topic: Pausing a Pi3D simulation?
Replies: 21
Views: 2485

Re: Pausing a Pi3D simulation?

Thank you so much, everything works perfectly now, although I may try and implement while loop to read button presses at some point. All I need to figure out now are those silly orbits :P
by Inkblot
Fri Oct 26, 2018 12:22 pm
Forum: Python
Topic: Pausing a Pi3D simulation?
Replies: 21
Views: 2485

Re: Pausing a Pi3D simulation?

Alright, the file is now on the repo and using your suggestion still reproduces the same problem but I noticed that when the simulation is paused, the Pi3D mouse stays on the button that was clicked (which is probably why more tk widgets are opened afterwards). I was thinking that a possible solutio...
by Inkblot
Fri Oct 26, 2018 10:06 am
Forum: Python
Topic: Pausing a Pi3D simulation?
Replies: 21
Views: 2485

Re: Pausing a Pi3D simulation?

I think we're getting somewhere. I used your modified RunSimulation method and added a close button to the tk widget but made some other changes in the simulation class: instead of the bool self.Opened I am using self.Factfile (which will be initially set to None in the constructor). It is the varia...
by Inkblot
Thu Oct 25, 2018 6:02 pm
Forum: Python
Topic: Pausing a Pi3D simulation?
Replies: 21
Views: 2485

Re: Pausing a Pi3D simulation?

Hi, so I have added the missing texture and font to the repository and added the import numpy as np statement to the python file. I apologise for not making it clear in the original post, but I am using Windows OS. However, building on your suggestion to toggle either Pi3D or tkinter at a time I man...
by Inkblot
Thu Oct 25, 2018 12:54 pm
Forum: Python
Topic: Pausing a Pi3D simulation?
Replies: 21
Views: 2485

Re: Pausing a Pi3D simulation?

Thanks for the reply and the pausing mechanism works perfectly. The simulation is a (key) part of my small project. When the user clicks on one of the GUI buttons, the simulation should be paused but also, a pop-up tkinter window should be displayed, showing information about the given planet the us...
by Inkblot
Wed Oct 24, 2018 5:35 pm
Forum: Python
Topic: Pausing a Pi3D simulation?
Replies: 21
Views: 2485

Pausing a Pi3D simulation?

Although it seems to have been a while since the last post regarding anything Pi3D, I just need a little nudge in the right direction. I have a simple display set up here with two spheres representing the Earth and Sun. When a GUI button is clicked, the camera focuses in on its corresponding planet:...

Go to advanced search