Very dumb question but in my Python 2.7 program (which works perfectly) the buttons of my tkinter GUI always take their graphical pushed position whenever I click on them. Is this a known issue, and is there any way around this?
Related
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'm creating a UI with python 3.7 with tkinter. I have a button that should open a dialog and ask for a string input, in windows it works entirely as expected but for some reason it won't work on any of 3 Macs I've tried. On the Macs the main window goes gray on top and you can't interact with it, so it's as if a dialog window has opened, but the dialog window is nowhere to be found. Python is not crashing or giving any error messages either. It's baffling to me that I have not been able to find any similar problems searching online.
The button calls this method:
def add_goal(self):
newgoal = simpledialog.askstring("Input", "What goal would you like to begin tracking?", parent=self.root)
self.goal_list.goals.append(goal.Goal(newgoal,0,0))
self.set_listbox()
print(self.goal_list)
I have tested the button with only a print statement so I know the button works.
I have also tested the button with only the simpledialog line so I know the other parts aren't causing a problem. I have also tried simpledialog.askinteger just to see and that didn't work either.
If relevant I'm doing from tkinter import simpledialog at the top.
And again this all works perfectly fine on windows.
Thanks for any help, I can post the entire code if anyone wants but I don't think any of it is relevant.
Was using root.attributes("-topmost", True), the code was derived from a program that was meant to be at the front of the screen at all times which is why that line was there to begin with, but I realized it was no longer necessary and it seems to be the source of the problem.
I am using a code designed by another person in MAC OS. I am using Windows instead and have slightly modified it, but the problem comes when using the GUI that is created.
I have already dealt with a similar issue with a slider. Once I pressed the slider, I couldn´t release it or press another button. I was forced to quit the GUI and start again. I solved it by changing the event command from EVT_COMMAND_SCROLL to EVT_COMMAND_SCROLL_THUMBTRACK. However I did not understand why it worked in MAC OS and does not work in Windows.
Now, I want to close the GUI with the typical cross inside the red button in the right corner of the window. I can do it if it is the first order I do in the GUI. If I first press any button or slider, the exit button does not work.
It made me consider if a major problem is hidden in the code which I am not seeing. I am new at wxPython, which is the module used in the code.
I just ask for your opinion and hope it is a basic error.
Thanks very much
I built a small GUI using Tkinter. The GUI features, among some other elements, three buttons. These buttons serve to open a dystem dialog and select certain data-files etc. One of the three buttons is a 'Go' button that runs the underlying data-processing.
When running the .py script the GUI works fine. However, after creating a developer app in alias mode using Py2App the buttons have become invisible! They're still there and usable, but invisible until interacted with.
How can I prevent this from happening?
I was stuck in your exact situation for quite some time. When I ran my tkinter script, it worked perfectly and all the buttons showed up, but once I packaged it, the buttons stopped showing up (They were still there but you couldn't see them). After a long time of trying random things, I found out how to make the buttons and their text show up again. Simply resize the window. Even a difference of 1 or 2 pixels does the trick. I have not yet found a way to PREVENT this issue, but at least this makes the app look right.
Please reply if you figure out a solution to prevent this!
Good Luck!