Question: I have a usage table with user\_id and login time. I want to get the number of users who logged in at least once a day. I also need to get the number of users who logged in at least once a week.

Any idea how can I go about it with a redshift query?

Here is the schema:

**user\_id: BigInt  

event\_time: Datetime**

Example results:

**No. of users who logged in at least once every day: 20
No. of users who logged in at least once week: 5**

Answer: 
One way is to make the child window transient to the root, so that you cannot interact with root until the child has been closed ( you don't need root.child\_window here):

```
import Tkinter as tk
import ttk

def about_window(): 
    top2 = tk.Toplevel(root)
    top2.title("About")
    top2.resizable(0,0)

    explanation = "This program is my test program"

    ttk.Label(top2,justify=tk.LEFT,text=explanation).pack(padx=5,pady=2)
    ttk.Button(top2,text='OK',width=10,command=top2.destroy).pack(pady=8)

    top2.transient(root)
    top2.grab_set()
    root.wait_window(top2)

root = tk.Tk()
root.resizable(0,0)

root.style = ttk.Style()
# ('clam', 'alt', 'default', 'classic')
root.style.theme_use("clam")

menu = tk.Menu(root)
root.config(menu=menu)

fm = tk.Menu(menu, tearoff=0)
menu.add_cascade(label="Settings",menu=fm)
fm.add_command(label="Preferances")

hm = tk.Menu(menu, tearoff=0)
menu.add_cascade(label="Help",menu=hm)
hm.add_command(label="About", command=about_window)
hm.add_command(label="Exit",command=root.quit)
#

tk.mainloop()

```
The easiest way to make your about window modal is afaik adding the follwing lines to your `about_window()` function:

```
top2.focus_set()                                                        
top2.grab_set()    

```

the first line sets the focus to your about window,

the second line prohibits any other window to accept events.