Python Forum

Full Version: GUI Opens Minimized
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
I have migrated a script that was running on Windows 7 to 10. Since the migration the Tkinter window is opening minimized (python 3.10.4) while that was not the case under Windows 7 (python 3.8.13). I hope it is not necessary to post all the code since it works under 3.8.13 but there must be something different I need under 3.10.4 to make the window open normal. Can someone help? TIA.
Does that opened minimized?

import tkinter as tk


root = tk.Tk()
root.title('Window')
root.geometry('600x400+50+50')

root.mainloop()
You should not need to post the whole code but I expect just a bare minimum of code that displays a tkinter window that shows the problem at hand would be required.
Thanks for the replies.

(Apr-12-2022, 06:05 PM)Axel_Erfurt Wrote: [ -> ]Does that opened minimized?
Hmm. No.

Here is the relevant code (I think I edited out all the unnecessary stuff) but there may be some selenium objects in there just for clarity as to where variables come from.

top=tk.Tk()
top.withdraw()
topWidth=600
topHeight=200
top.title("Do Not Call Interface")
top.geometry(str(topWidth)+'x'+str(topHeight))
top.resizable(False,False)
rw=0
myPhone=tk.StringVar()
tk.Radiobutton(top,text='xxxxxxxxxx',variable=myPhone,value='xxxxxxxxx').grid(row=rw,column=0,pady=5,columnspan=2)
tk.Radiobutton(top,text='xxxxxxxxxx',variable=myPhone,value='xxxxxxxxx').grid(row=rw,column=2,pady=5,columnspan=2)
tk.Radiobutton(top,text='xxxxxxxxxx',variable=myPhone,value='xxxxxxxxx').grid(row=rw,column=4,pady=5,columnspan=2)
myPhone.set('770-466-7932')
rw+=1
tk.Label(top,text='Phone',justify=tk.LEFT).grid(row=rw,column=0,pady=5,sticky=tk.W)
phone=tk.Entry(top,width=12,justify=tk.LEFT)
phone.grid(row=rw,column=1,pady=5,sticky=tk.W)
phone.insert(0,num)
phone.focus_set()
rw+=1
tk.Label(top,text='Caller Name',justify=tk.LEFT).grid(row=rw,column=0,pady=5,sticky=tk.W)
name=tk.StringVar()
nameEntry=tk.Entry(top,textvariable=name,width=48,justify=tk.LEFT)
nameEntry.grid(row=rw,column=1,pady=5,columnspan=4)
name.set(nme)
rw+=1
tk.Label(top,text='Date',justify=tk.LEFT).grid(row=rw,column=0,pady=5,sticky=tk.W)
dateTime=datetime.now()
today=tk.Entry(top,width=10,justify=tk.LEFT)
today.grid(row=rw,column=1,pady=5,sticky=tk.W)
today.insert(0,dte)
tk.Label(top,text='Time',justify=tk.LEFT).grid(row=rw,column=2,pady=5,sticky=tk.W)
now=tk.Entry(top,width=6,justify=tk.LEFT)
now.grid(row=rw,column=3,pady=5,sticky=tk.W)
ampm=tk.IntVar()
now.insert(0,tim)
if (pmam=='AM'):
    ampm.set(1)
else:
    ampm.set(2)
tk.Radiobutton(top,text='AM',variable=ampm,value=1).grid(row=rw,column=4,pady=5,sticky=tk.W)
tk.Radiobutton(top,text='PM',variable=ampm,value=2).grid(row=rw,column=5,pady=5,sticky=tk.W)
rw+=1
subjectList=Select(browser.find_element_by_css_selector('#ddlSubjectMatter'))
selections={}
for opt in subjectList.options:
    if (opt.text!=''):
        selections[opt.get_attribute('value')]=opt.text
subject=tk.StringVar()
subjectMatter=ttk.Combobox(top,textvariable=subject,width=53,justify=tk.LEFT)
subjectMatter['state']='readonly'
subjectMatter['values']=list(selections.values())
tk.Label(top,text='Subject',justify=tk.LEFT).grid(row=rw,column=0,pady=5,sticky=tk.W)
subjectMatter.grid(row=rw,column=1,columnspan=5)
subject.set('Unknown')
rw+=1
submitButton=tk.Button(top,text='Submit',command=lambda: validatePhone(top))
submitButton.grid(row=rw,column=2,pady=5,sticky=tk.W)
cancelButton=tk.Button(top,text='Cancel',command=lambda: cancel(top,browser)).grid(row=rw,column=4,pady=5,sticky=tk.W)
center(top)
gui.destroy()
top.mainloop()
Have you tried this code?
(Apr-12-2022, 06:31 PM)Axel_Erfurt Wrote: [ -> ]Have you tried this code?
As I replied earlier, I did and it opened normally.
I mean the code you posted?
(Apr-12-2022, 06:45 PM)Axel_Erfurt Wrote: [ -> ]I mean the code you posted?
Oh, no it won't run properly as is. There are many dependencies like Selenium and an application called PhoneTrayPro to make it work.
That's not a very useful example since it cannot be run to demonstrate the problem. In the real code do you withdraw the top window? If so, how do you make the window appear?
(Apr-12-2022, 07:14 PM)deanhystad Wrote: [ -> ]That's not a very useful example since it cannot be run to demonstrate the problem. In the real code do you withdraw the top window? If so, how do you make the window appear?
Unless I post all the code there is not much else I can do without rewriting it at which time it would not longer represent the issue. I make the window appear by clicking on the minimized icon on the task bar.
Pages: 1 2 3