Gui Flashcards

1
Q

What does GUI stand for?

A

Graphical user interface

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What Python module can be used to create a gui?

A

The Tkinter GUI module tool kit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Import everything from tkinter:

A

From tkinter import *

(The asteroid means everything)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Windows

A

Serves as a container to hold widgets

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Widgets

A

GUI elements: buttons, text boxes, labels , images

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Create a window called window with Tk

A

this instantiates an instance of a window

Window = Tk()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Display a window

A

places window on computer screen, listens for events

Window = Tk()
Window.mainloop()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Set a windows geometry(size) to 500x500

A

Window.tk()
Window.geometry(“500x500”)
Window.mainloop()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Change window title

A

Window.tk()
Window.geometry(“500x500”)
Window.title(“title”)
Window.mainloop()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Change icon for gui

A

Icon = PhotoImage(file=‘icon.png’)
Window.iconphoto(true,icon)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Configure your windows background to black

A

Window.config(background=“black”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Add a label to your window

A

Window =Tk()
Window.mainloop()
Label =label(window,text=‘HELLO’

Label.pack()#adds to window
Or
Label.place(x=0,y=0)

the first argument taken in by our label function is the name of our window variable (in this case it’s called window)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Change font of label

A

Label = label(window,text=“cum”,font=(‘fontype’, size,bold))

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What other kwargs can be used in a label?

A

The relief eg. Relief= RAISED
fg=“colour”
bg=“colour”
Padx
Pady
Image=photo
Compound=“bottom”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly