File: PmwMessageDialog.py.html

package info (click to toggle)
python-pmw 0.6.2-0.1
  • links: PTS
  • area: main
  • in suites: hamm
  • size: 1,652 kB
  • ctags: 2,716
  • sloc: python: 10,720; makefile: 44; sh: 24
file content (89 lines) | stat: -rw-r--r-- 2,979 bytes parent folder | download | duplicates (3)
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<!DOCTYPE HTML PUBLIC "-//Netscape_Microsoft//DTD HTML 3.0//EN">
<HTML>

<!-- This file generated using the Python HTMLgen module. -->
<HEAD>
  <META NAME="GENERATOR" CONTENT="HTMLgen 1.1">
        <TITLE>PmwMessageDialog.py</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<PRE>
<FONT COLOR="#DD0000"># Based on iwidgets2.2.0/messagedialog.itk code.</FONT>

import Tkinter
import Pmw

<FONT COLOR="#DD0000"># A Toplevel with a ButtonBox and child site.</FONT>

<STRONG><FONT COLOR="#CC6600">class MessageDialog</FONT></STRONG>(Pmw.Dialog):
<STRONG>    def __init__</STRONG>(self, parent = None, **kw):

	<FONT COLOR="#DD0000"># Define the megawidget options.</FONT>
	INITOPT = Pmw.INITOPT
	optiondefs = (
	    (<FONT COLOR="#009900">'borderx'</FONT>,       20,    INITOPT),
	    (<FONT COLOR="#009900">'bordery'</FONT>,       20,    INITOPT),
	    (<FONT COLOR="#009900">'iconmargin'</FONT>,    20,    INITOPT),
	    (<FONT COLOR="#009900">'iconpos'</FONT>,       None,  INITOPT),
	)
	self.defineoptions(kw, optiondefs)

	<FONT COLOR="#DD0000"># Initialise the base class (after defining the options).</FONT>
	Pmw.Dialog.__init__(self, parent)

	<FONT COLOR="#DD0000"># Create the components.</FONT>
	interior = self.interior()

	self._message = self.createcomponent(<FONT COLOR="#009900">'message'</FONT>,
		(), None,
		Tkinter.Label, (interior,))

        iconpos = self[<FONT COLOR="#009900">'iconpos'</FONT>]
	iconmargin = self[<FONT COLOR="#009900">'iconmargin'</FONT>]
	borderx = self[<FONT COLOR="#009900">'borderx'</FONT>]
	bordery = self[<FONT COLOR="#009900">'bordery'</FONT>]
	border_right = 2
	border_bottom = 2
	if iconpos is None:
	    self._message.grid(column = 1, row = 1)
	else:
	    self._icon = self.createcomponent(<FONT COLOR="#009900">'icon'</FONT>,
		    (), None,
		    Tkinter.Label, (interior,))
	    if iconpos not in <FONT COLOR="#009900">'nsew'</FONT>:
		raise ValueError, \
		    <FONT COLOR="#009900">'bad iconpos option "%s":  should be n, s, e, or w'</FONT> \
			% iconpos

	    if iconpos in <FONT COLOR="#009900">'nw'</FONT>:
		icon = 1
		message = 3
	    else:
		icon = 3
		message = 1

	    if iconpos in <FONT COLOR="#009900">'ns'</FONT>:
		<FONT COLOR="#DD0000"># vertical layout</FONT>
		self._icon.grid(column = 1, row = icon)
		self._message.grid(column = 1, row = message)
		interior.grid_rowconfigure(2, minsize = iconmargin)
		border_bottom = 4
	    else:
		<FONT COLOR="#DD0000"># horizontal layout</FONT>
		self._icon.grid(column = icon, row = 1)
		self._message.grid(column = message, row = 1)
		interior.grid_columnconfigure(2, minsize = iconmargin)
		border_right = 4

	interior.grid_columnconfigure(0, minsize = borderx)
	interior.grid_rowconfigure(0, minsize = bordery)
	interior.grid_columnconfigure(border_right, minsize = borderx)
	interior.grid_rowconfigure(border_bottom, minsize = bordery)


	<FONT COLOR="#DD0000"># Check keywords and initialise options.</FONT>
	self.initialiseoptions(MessageDialog)

</PRE>

 </BODY> </HTML>