3 Replies - 207 Views - Last Post: 03 July 2013 - 08:18 AM Rate Topic: -----

#1 njjmfm  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 04-February 13

Cannot get a child window to reopen

Posted 03 July 2013 - 06:30 AM

I imported one of my Python files into a main file that will handle my whole app. When I click a button on my app, it opens a self created help menu. If I close the menu, it closes but I can't reopen it at all. I did try to use:

 root.Show() 
and
 root.show() 


these worked as I wanted them to, but they threw an error that didn't seem to hurt the program:

AttributeError Show


I don't know how I can get the help menu to open 2 or 3 or as many times as needed.

Please help

Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: Cannot get a child window to reopen

#2 tlhIn`toq  Icon User is offline

  • Please show what you have already tried when asking a question.
  • member icon

Reputation: 5522
  • View blog
  • Posts: 11,830
  • Joined: 02-June 10

Re: Cannot get a child window to reopen

Posted 03 July 2013 - 06:41 AM

Did you actually close it... or hide it...?

If it was closed then went out of scope I would expect the object to be disposed of and you would have to make a new one. If you only hide it then it doesn't get disposed of.

But I'm taking C# concepts and trying to apply them to your question.

Even the python guys here would have a hard time helping with so little to go on. If you could provide the code you use when closing the window that would help.
Was This Post Helpful? 0
  • +
  • -

#3 njjmfm  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 04-February 13

Re: Cannot get a child window to reopen

Posted 03 July 2013 - 06:43 AM

from Tkinter import *
import sys


root = Tk()
root.title("Help")
scrollbar = Scrollbar(root)
scrollbar.pack(side=RIGHT, fill=Y)

help_message = 'This is the help menu. Please scroll through the menu to find the answer to your question'

txt = Text(root, wrap=WORD)
txt.pack(expand=1, fill=BOTH)
txt.insert(END, help_message)

txt.config(yscrollcommand=scrollbar.set, state=DISABLED)
scrollbar.config(command=txt.yview)

root.mainloop()

if sys.exit:
    root.destroy()



Maybe I should use a hide instead of a destroy??
Was This Post Helpful? 0
  • +
  • -

#4 njjmfm  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 04-February 13

Re: Cannot get a child window to reopen

Posted 03 July 2013 - 08:18 AM

I added the line :
 root.withdraw()
and in the main file I imported the file and added the line
HelpBox.root.deiconify()

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1