Shared Flashcard Set

Details

Week 9
programming principles
14
Computer Science
Post-Graduate
11/09/2017

Additional Computer Science Flashcards

 


 

Cards

Term
1.What is a Graphical User Interface (GUI)?
Definition
how most people interact w computer each day. Windows, icons, buttons, dialog boxes etc. Interaction via keyboard + mouse
Term
2.What is a Command Line Interface (CLI)?
Definition
text based interface. Code prompts user for input. Allows them to type commands
Term
3.Outline the concept of event-driven programming.
Definition
the user can interact with any active part of the GUI at any time. User triggers an event by interacting with the GUI, code runs in response to these events
Term
4.Define the terms "main loop", "event" and "event handler".
Definition
main loop: constantly listens for events such as mouse click, typing, mouse hovering etc

event - see above

event handler: once the event happens it triggers a function which has been set to handle the event. Event handler is attached to the event

Endless loop
wait for event
if event is 'quit'
break
else
handle event
Term
5.Name and briefly describe 5 widgets available in the "tkinter" module (i.e. Tk).
Definition
label - display text
button - bsic window operation
frame - layout of widgets in a window
entry - text input field
check button/ radio button - form elements
Term
6.Write code that creates a "Label" widget with the text "Hello" and packs it to the bottom side of a window named "main".
Definition
label (self.main, text = 'Hello')
label.pack (side = 'bottom')
Term
7.What are "Frame" widgets used for?
Definition
widget or container that holds other widgets. Used to implement more sophisticated layouts
Term
8.How do you specify a function or method to call when a "Button" widget is clicked?
Definition
you attach a command so that the method happens when the button is clicked. Method could be to show a message for example
Term
9.Describe some of the message boxes types that can be shown using the "tkinter.messagebox" module.
Definition
- showinfo(), - showwarning(), - showerror() or decision boxes:
- askyesno(), -askokcancel(), - askretrycancel()
Term
10.What do "tkinter.INSERT" and "tkinter.END" reference in an "Entry" widget?
Definition
specify a start and end point in the field
Term
11.How do you get and set the value of a "StringVar" object?
Definition
used to show what an entry or label contains.
set() will allow you to change the entry or label by changing the StringVar
get() gives you the current value of the StringVar

Basically reuse labels/entry boxes etc
Term
12.Why is it useful to create a mockup of a GUI before trying to implement it?
Definition
same reason you would do pseudocode/flow chart. Planning design, save time when actually programming
Term
13.What is a GUI builder?
Definition
lets you build gui in a visual way. basically drag and drop widgets. Tweak the settings and the code is produced
Term
14.Why is XML being used to define program GUIs?
Definition
simplify GUI creation and increase maintainability. Separate the GUI from the code
Supporting users have an ad free experience!