Python Programming for Biology: Bioinformatics and Beyond


Widgets and graphics libraries



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

Widgets and graphics libraries

Most graphical interfaces are composed of discrete graphical objects like buttons, menus

and text boxes etc. Collectively these are referred to as widgets.

2

In general each on-screen



widget  will  have  a  corresponding  computational  object.  Such  widget  classes  allow  the

programmer to build graphical interfaces from common building blocks, without having to

worry about how the object is drawn on screen. For example, if we add a clickable button

to a program we usually only have to think about its general placement and what operation




it triggers. The graphical library that lies behind the widget will take care of exactly where

and how to draw its pixels. Occasionally, however, the standard graphical objects are not

sufficient  to  meet  our  needs,  and  we  may  have  to  create  customised  or  even  completely

novel  widgets,  although  the  common  graphics  libraries  have  tools  to  do  this  without  too

much pain.

Before attempting to construct a GUI the programmer must first make the choice about

which  graphics  library  to  use,  i.e.  which  system  of  widgets  the  interface  will  be

constructed  with.  Graphical  systems  are  generally  not  directly  available  within  the  core

Python  libraries,  but  there  are  various  capable  choices  and  some  of  the  more  popular

include PyGtk, Tkinter, PyQt and WxPython. Because of the limited space in this book we

will  focus  on  just  a  couple  of  these:  Tkinter  and  PyQt.  Both  of  these  libraries  are  cross-

platform and will run on Linux, Mac and Windows operating systems. The Tkinter library,

which is Python wrapping around a system known as Tcl/Tk, is not the most sophisticated

or most modern graphical system, but it is the de facto standard for Python and is usually

bundled  with  the  standard  Python  installation  for  Windows.  Hence,  if  you  want  to  do

something  quick  and  simple  then  Tkinter  may  be  the  best  choice.  PyQt  and  PySide,  an

alternative implementation, are Python wrappers to the Qt libraries, written in C++. This is

a more sophisticated, state-of-the-art choice and includes support for OpenGL (for fast 3D

graphics),  embedded  web  browsing  and  basic  multimedia  support,  to  name  only  a  little.

Thus  we  would  recommend  Qt  for  larger  projects.  Especially  helpful  is  the  Qt  Designer

system,  which  allows  you  to  lay  out  widgets  in  a  graphical  (non-programmatic)  way,

although in this chapter we demonstrate only the direct programming route.




Download 7,75 Mb.

Do'stlaringiz bilan baham:
1   ...   424   425   426   427   428   429   430   431   ...   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