File: simpledialog.pyw

package info (click to toggle)
guiqwt 2.1.6-4
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 5,408 kB
  • sloc: python: 21,161; cpp: 1,564; fortran: 93; f90: 24; makefile: 16
file content (27 lines) | stat: -rw-r--r-- 776 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# -*- coding: utf-8 -*-
#
# Copyright © 2009-2010 CEA
# Pierre Raybaut
# Licensed under the terms of the CECILL License
# (see guiqwt/__init__.py for details)

"""Very simple dialog box"""

from guiqwt.plot import ImageDialog
from guiqwt.builder import make

class VerySimpleDialog(ImageDialog):
    def set_data(self, data):
        plot = self.get_plot()
        item = make.trimage(data)
        plot.add_item(item, z=0)
        plot.set_active_item(item)
        plot.replot()

if __name__ == "__main__":
    import numpy as np
    from guidata import qapplication
    _app = qapplication()
    dlg = VerySimpleDialog()
    dlg.set_data(np.random.rand(100, 100))
    dlg.exec_() # No need to call app.exec_: a dialog box has its own event loop