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: 
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.
The other method is made a lot easier by using a Class to represent your program. It essentially boils down to the need for a global (or scope of the class instance) variable. In this case we use `self.top2` which can be accessed inside and outside the method `about_window()`.

This method will allow for full interaction with the root window while the child window is open.

```
import Tkinter as tk
import ttk

class MyProgram():

    def __init__(self):

        self.top2 = None
        self.root = 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=self.about_window)
        hm.add_command(label="Exit",command=root.quit)

    def about_window(self):
        try:
            self.top2.focus_set()
            return
        except Exception:
            pass

        self.top2 = top2 = tk.Toplevel(self.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)

MyProgram()
tk.mainloop()

```