FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
pythonnet/demo/splitter.py at develop · pythonindy/pythonnet · GitHub
pythonindy
pythonnet
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
pythonnet
/
demo
/
splitter.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
97 lines (72 loc) · 3.4 KB
Breadcrumbs
pythonnet
/
demo
/
splitter.py
Copy path
File metadata and controls
97 lines (72 loc) · 3.4 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
90
91
92
93
94
95
96
# ===========================================================================
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE.
# ===========================================================================
import
System
.
Windows
.
Forms
as
WinForms
from
System
.
Drawing
import
Color
,
Size
,
Point
import
System
class
Splitter
(
WinForms
.
Form
):
"""A WinForms example transcribed to Python from the MSDN article:
'Creating a Multipane User Interface with Windows Forms'."""
def
__init__
(
self
):
# Create an instance of each control being used.
self
.
components
=
System
.
ComponentModel
.
Container
()
self
.
treeView1
=
WinForms
.
TreeView
()
self
.
listView1
=
WinForms
.
ListView
()
self
.
richTextBox1
=
WinForms
.
RichTextBox
()
self
.
splitter1
=
WinForms
.
Splitter
()
self
.
splitter2
=
WinForms
.
Splitter
()
self
.
panel1
=
WinForms
.
Panel
()
# Set properties of TreeView control.
self
.
treeView1
.
Dock
=
WinForms
.
DockStyle
.
Left
self
.
treeView1
.
Width
=
self
.
ClientSize
.
Width
/
3
self
.
treeView1
.
TabIndex
=
0
self
.
treeView1
.
Nodes
.
Add
(
"TreeView"
)
# Set properties of ListView control.
self
.
listView1
.
Dock
=
WinForms
.
DockStyle
.
Top
self
.
listView1
.
Height
=
self
.
ClientSize
.
Height
*
2
/
3
self
.
listView1
.
TabIndex
=
0
self
.
listView1
.
Items
.
Add
(
"ListView"
)
# Set properties of RichTextBox control.
self
.
richTextBox1
.
Dock
=
WinForms
.
DockStyle
.
Fill
self
.
richTextBox1
.
TabIndex
=
2
self
.
richTextBox1
.
Text
=
"richTextBox1"
# Set properties of Panel's Splitter control.
self
.
splitter2
.
Dock
=
WinForms
.
DockStyle
.
Top
# Width is irrelevant if splitter is docked to Top.
self
.
splitter2
.
Height
=
3
# Use a different color to distinguish the two splitters.
self
.
splitter2
.
BackColor
=
Color
.
Blue
self
.
splitter2
.
TabIndex
=
1
# Set TabStop to false for ease of use when negotiating UI.
self
.
splitter2
.
TabStop
=
0
# Set properties of Form's Splitter control.
self
.
splitter1
.
Location
=
System
.
Drawing
.
Point
(
121
,
0
)
self
.
splitter1
.
Size
=
System
.
Drawing
.
Size
(
3
,
273
)
self
.
splitter1
.
BackColor
=
Color
.
Red
self
.
splitter1
.
TabIndex
=
1
# Set TabStop to false for ease of use when negotiating UI.
self
.
splitter1
.
TabStop
=
0
# Add the appropriate controls to the Panel.
for
item
in
(
self
.
richTextBox1
,
self
.
splitter2
,
self
.
listView1
):
self
.
panel1
.
Controls
.
Add
(
item
)
# Set properties of Panel control.
self
.
panel1
.
Dock
=
WinForms
.
DockStyle
.
Fill
self
.
panel1
.
TabIndex
=
2
# Add the rest of the controls to the form.
for
item
in
(
self
.
panel1
,
self
.
splitter1
,
self
.
treeView1
):
self
.
Controls
.
Add
(
item
)
self
.
Text
=
"Intricate UI Example"
def
Dispose
(
self
):
self
.
components
.
Dispose
()
WinForms
.
Form
.
Dispose
(
self
)
def
main
():
app
=
Splitter
()
WinForms
.
Application
.
Run
(
app
)
app
.
Dispose
()
if
__name__
==
'__main__'
:
main
()
Back
|
FazBrowse Home
|
New Git URL