Python Programming for Biology: Bioinformatics and Beyond



Download 7,75 Mb.
Pdf ko'rish
bet429/514
Sana30.12.2021
Hajmi7,75 Mb.
#91066
1   ...   425   426   427   428   429   430   431   432   ...   514
Bog'liq
[Tim J. Stevens, Wayne Boucher] Python Programming

GUI construction

When  constructing  a  GUI  there  are  a  few  main  areas  that  the  programmer  must  think

about above and beyond the appearance of the graphical items. At the simplest level the

widgets  that  constitute  a  GUI  will  collect  information  from  the  user,  trigger  various

actions  (i.e.  function  calls)  and  display  information.  Thus  the  graphical  objects  need  a

means  of  interacting  with  the  other  parts  of  the  program,  which  is  commonly  kept

somewhat separate from the GUI code. When a user interacts with a widget, e.g. to enter

some text into a box, the program needs to access that data and perhaps change the state of

the  graphics  accordingly.  With  these  interactions  in  mind,  we  use  the  term  callback  to

describe  the  process  of  graphical  widget  calling  a  function  in  our  main  program  and  the

term  update  to  describe  the  setting  of  the  widgets  to  display  new  information.  The  term

signal  is  general  and  will  refer  to  both  callback  and  update  operations.  To  give  a  more

specific example, if a graphical interface is constructed with a tick box (check button) we

can specify a function to be called when the state changes, i.e. when the box is ticked. This

callback from the widget then invokes some change in our program. Conversely, we may

wish to send a signal in the opposite direction so that the tick box is kept updated to reflect

the  state  of  the  main  program  after  some  event.  Inherent  in  this  sort  of  thinking  is  the

notion that the GUI forms a separate layer to the rest of the program.

A  GUI  is  programmed  by  selecting  which  kinds  of  widgets  are  to  be  used,  how  they

signal  to  interact  with  the  rest  of  the  program  and,  of  course,  how  the  objects  are

displayed. When it comes to display, a widget is either placed directly in the context of the




screen or inside the borders of another widget. A top-level widget is the term that we will

use for a widget that is not graphically contained by another. The usual form of top-level

widgets in today’s operating systems is a window. The geometry of a top-level widget, in

terms  of  position  and  size,  is  something  that  is  often  adjusted  by  the  user.  However,  the

placement of sub-widgets that go inside the top level is not usually subject to user control.

The  positioning  of  such  widgets  is  a  large  part  of  the  GUI’s  design,  and  the  items  are

generally  placed  to  make  operations  convenient  and  intuitive.  Placement  of  internal

widgets is usually done in a fairly flexible way so that the interface can cope when the top-

level window is resized. Accordingly, it is more common to specify that a widget sticks to

the edge of a window, or expands to fit the current size, rather than specifying its location

absolutely.  Graphical  libraries  will  have  a  layout  or  geometry  management  system  as  a

means  of  directing  where  widgets  are  placed.  For  example,  we  often  just  specify  that

widgets  are  stacked  vertically,  lie  horizontally  or  are  arranged  in  a  grid  and  the  layout

manager handles the fine placement automatically (e.g. making things line up).




Download 7,75 Mb.

Do'stlaringiz bilan baham:
1   ...   425   426   427   428   429   430   431   432   ...   514




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish