I've been working quite a bit with tkinter in Python. I was wondering if there is a way to combine another program into my python GUI script. Here is specifically what I am trying to accomplish:
Python GUI Opens
Left side of GUI is custom content (buttons etc.)
Right side is parented MS Word document (When I move the root window the MS Word document moves accordingly)
You can't do what you want.
In a very, very limited sense you can embed a very few applications on linux, but for all intents and purposes you simply cannot embed a non-tkinter graphical application inside a tkinter window.
Related
I am trying to make a GUI in python that only consists of 1 window. I think this is better explained with examples. If you have say the settings app open on the computer when you click an option a new window doesn't pop up, the original window changes the a new layout. Is there a way to do this without deleting everything in the window and then adding new stuff, and when going back doing the same process.
If you're using a QT based gui framework like PyQT or PySimpleGUI, you can accomplish this task using a Tab object. Here is a link to a sample program with using Tabs in PySimpleGUI
PySimpleGUI is a really good option for getting your feet wet with GUI development in Python. You can get a lot done with very little code and learn about how GUI's work.
So I am trying to make a python script that when I do a certain hotkey combination, It shows a text box as an overlay like what "Geforce Experience" and "Windows Gamebar" do.
the problem is that in the game when I interact with the text-area loses focus and goes minimized as opposed to the 2 programs I spoke about before, for example windows game bar allows you interact with a lot of options while the game is still on foreground and you close the bar you are left with whatever you were with before...
I'm using tkinter for now, and if there are solution not including tkinter it is Ok as long as it achives the goal.
As far as I understand what you are trying to do is create a overlay for a game and the overlay should be created using tkinter object. Here is a library that can do that, however as far as I remember you needed to change something in it's python file, however this might have already been fixed.
I am trying to embed a chat system (that is a gui) within another gui I have already created. I have tested the chat application separately (it uses socket programming) and it works fine, but when I copy and paste that code into the original gui application (so that when I press a button it opens the chat application), it stops working.
I don't know why this is happening, so any insight would be helpful. I have a feeling it has something to do with the fact that I am trying to run a gui within a gui, but I am not sure, as this is the first time I'm working with python gui's.
Use the Tkinter Toplevel window instead of Tk window. You should never have two Tk windows.
I have looked at similar questions that may answer my question but I am still very unclear on how to go about the following:
I can create programs to run in the Python Shell in Idle and I can also set up windows with widgets in Tkinter, but whatever I create in Tkinter is pointless because I cannot figure out how to take my Python Shell code and "wrap" it in the Tkinter GUI.
I have assumed that it cannot be done, and that entirely new code must be written to assist the language that is specific to Tkinter. I am very confused on how to create a well-rounded program without being left with just a GUI "skeleton" with random buttons, labels, entries, etc. and a Python program that is very unappealing and can only run in the ugly little Shell.
What you create with Tkinter is not pointless. It sounds to me like you're trying to compile a stand-alone program in Python, using the Tkinter library to provide the GUI. Once you have a script working, you can use a program to compile into a standalone program. Look into using py2app on a mac, or py2exe on Windows. Google them and see if that's what you're looking for.
Porting an application from command line to GUI might require some rework (depending on degree of interactivity you want to achieve).
Basically, in a GUI application, you build a few widgets (buttons...) at startup, and then perfom all your actions "on reaction" of user input. You typically do this by binding callbacks onto your widgets (button, input field), and then enter a mainloop (or eventloop).
You might read this chapter about events and binding.
If your application is mainly computing oriented, providing a gui with a "launch" button, and an output field is straightforward. If you perform some command line input, you can switch to widget input at low cost. More interactive apps will require to be architectured toward interaction capabilities.
I am new to both python and gui programming.
I am working on a python script which would pop-up a Tkinter dialog which needs to sit on top of another application (say Outlook for example) and should not allow me to do anything in Outlook until I click the cancel button on the tkinter dialog or until the dialog is withdrawn.
I am looking for some examples on how to do this.
It's possible, but you have to be very, very careful. If you make a programming mistake you can effectively disable your computer.
What you want to do is called a "global grab". That is, you grab all events. You do this with the tkinter command grab_set_global. You should test your application by adding a timer that automatically kills your program after a set amount of time so you aren't forced to reboot.