python - radio button and display widgets on designer-qt4 -


i have shell script old text-based user interface: want replace shell code python , create graphical user interface using qt designer tool , pyside.

i able add menu bar, tab , radio buttons.

when user selects radio button show in text box brief description of selection means; when selects radio button different description on same text box should appear , on.

my questions are:

  1. what widget should use text box ? thinking @ text browser display widget, i'm not sure. label ? text edit ?
  2. when connect radio button text browser can see interesting slots under text browser such inserthtml or insertplaintext, select signal clicked() on radio button disappear , i'm not able find them again.
  3. i tried connect button label widget, i'm not able find kind of settext slot. reading documentation know settext exists, cannot use inside code.

thanks kind of support.

qt has several different built-in apis showing messages user, suggest give consideration these before trying roll own solution:

  • for simple message describes gui element is, can set tooltip.
  • for longer messages describe gui element does, can set status tip. these used menu items , toolbar buttons.
  • for longer, more informative messages, can use what's mode. these messages can make use of html formatting, , can include links main help.

the demo script below uses these methods, , shows how handle links in "what's this" messages:

from pyqt4 import qtcore, qtgui  class window(qtgui.qmainwindow):     def __init__(self):         qtgui.qmainwindow.__init__(self)         self.statusbar()         self.toolbar = self.addtoolbar('toolbar')         action = qtgui.qwhatsthis.createaction(self)         action.setstatustip('enter what\'s mode')         self.toolbar.addaction(action)         widget = qtgui.qgroupbox(self)         layout = qtgui.qvboxlayout(widget)         self.setcentralwidget(widget)         name in 'one 2 3 four'.split():             checkbox = qtgui.qcheckbox('checkbox %s' % name, self)             checkbox.settooltip('tooltip checkbox %s' % name)             checkbox.setwhatsthis("""                 <b>what\'s text</b>:<br><br>                 checkbox %s<br><br>                 <a href="url-%s">link main help</a>                 """ % (name, name))             checkbox.installeventfilter(self)             layout.addwidget(checkbox)      def eventfilter(self, source, event):         if event.type() == qtcore.qevent.whatsthisclicked:             print(event.href())         return qtgui.qmainwindow.eventfilter(self, source, event)  if __name__ == '__main__':      import sys     app = qtgui.qapplication(sys.argv)     window = window()     window.setgeometry(500, 300, 250, 200)     window.show()     sys.exit(app.exec_()) 

Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -