How to switch between screens / frames in tkinter? - python

My app is getting a bit big in size so I am trying to create sections like in the example image. When I click to general it will switch to general page, gonna switch to api for api page etc. I haven't used frames in my app at all.
Do I need to code everything from zero with frames to do this? Thanks.

You can just use ttk.Notebook, they have a tabControl modul.
You can use this tutorial: https://www.youtube.com/watch?v=kqbkUKIc1Gk
Or read this article: https://www.geeksforgeeks.org/creating-tabbed-widget-with-python-tkinter/

Related

Set window size for Ursina Engine for Python

I'm using Ursina Engine to make a game. However I can't figure out a way how to set a specific size for the window. I need to figure this out, because I can't see part of it, because it's bigger than my screen.
I tried to use other posts on StackOverflow, but couldn't find anything. I also tried to use ChatGPT, however it didn't help.
A google search led me to the documentation of the engine, where I found this:
https://www.ursinaengine.org/api_reference.html
As I understand it your main app class Ursina(), can accept various arguments, including amongst others 'size'.
Scrolling further down to the part named 'ASCIIEditor' there's an example usage:
app = Ursina(size=(1920,1080))
My experience with Ursina is limited to some introductory videos, so take this for what it is.

R Shiny equivalent in Python? Creating a window-based tool

I am trying to transfer an app i build in R Shiny to Python Code.
It's main use is to set the input parameters for a data analysis to be run which should create and output pdf file.
So far I managed to understand that DASH might be the tool to go with. But is there a way to launch a DASH app in an external window (not in a browser window)? Like the following:
After setting the Input values I want to have a button to click "Run" or something similiar to run the underlying code and generate a PDF Report. How would you do that with Python and do you maybe know a good Tutorial how to build a basic app like this?
I'm not exactly sure what you mean in the first part of your question. You may be able to use an IDE with integrated broswer to view your app during developement if you don't want to use a broswer. But the whole point of dash is to be a web based application, so it would be best on a browser.
Alternately, you can save the rendered output from browser to a .html file if you need to share it without having a live server host your application.
For the second part of your question, for a button click to generate a pdf report, refer to the documentation of callback in dash.
The callback function for the Run Analysis button can then be something on the lines of
def generate_report():
#Code to generate required pdf
# Code to download on client
return link_to_pdf
Hope this gives some pointers in the direction.

Adding plain text to a Nuke simple panel window

I work with Nuke all the time and I know simple Python to create simple tools in it. I’ve been able to carry out moderately complicated actions with panels and tools but I am stuck with something that should be very simple, but I can’t seem to find the answer here or in nukepedia or in the foundry help and tutorials. I want to add some simple text to my panel. For example:
p = nuke.Panel('test')
p.message('This is where I hope to display an explanation of the tool')
p.addButton('Quit')
Where I use p.message just as a placeholder for what I need.
Any help would be appreciated, I feel like this is so simple that it isn’t included in most of the documentation.
For windows bringing a simple message use this code:
nuke.message('Explanation of the Tool')
If you need user's yes/no choice, use this code:
if nuke.ask('Do you like to create ColorWheel node?'):
nuke.createNode('ColorWheel')
In case you need a panel, use the following code:
panel = nuke.Panel('Test panel')
panel.addNotepad('Explanation Here','Explanation of the Tool')
panel.addButton('Quit')
..and then:
panel.show()

pptx-python - Powerpoint always opens on master slide page

I have an app that creates powerpoints. Everything goes well except that every time I want to open one of these powerpoints it opens it in the slide master view. This isn't necessarily a problem per se, but just annoying since I open a lot of these powerpoint files. Has anyone else encountered this? Any idea what this is due to?
This happens on both mac and windows.
I create a presentation from a template, generate the slides and then save it more or less like this:
self.prs = Presentation(
self.template_path)
for c, slide in enumerate(self.data):
self.generate_slide(slide)
self.prs.save(save_location)
I had this issue before, it was because the template slide was saved in the slide master view same as what Johnathon said.

How can I embed Google maps into a wxPython program?

I would like to create a program using wxPython that uses Google maps to display and select geographic data.
Is there a proven, ready to use widget for this?
There are no pre-made widgets that I'm aware of. I did find PySlip, which is similar to what you're talking about: http://code.google.com/p/pyslip/wiki/Introduction
There is a webkit port that's being worked on for wxPython as well. There's a preview build here that's kind of old:
http://wxwebkit.wxcommunity.com/index.php?n=Main.Downloads
I know the author has been working on an update to it for quite some time though.

Categories

Resources