8000 Fix demo scripts · pythonnet/pythonnet@5ee587d · GitHub
[go: up one dir, main page]

Skip to content

Commit 5ee587d

Browse files
filmorlostmsu
authored andcommitted
Fix demo scripts
1 parent 31b9c4e commit 5ee587d

File tree

3 files changed

+14
-9
lines changed

3 files changed

+14
-9
lines changed

demo/helloform.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
import clr
55

6-
SWF = clr.AddReference("System.Windows.Forms")
7-
print (SWF.Location)
6+
clr.AddReference("System.Windows.Forms")
87
import System.Windows.Forms as WinForms
98
from System.Drawing import Size, Point
109

@@ -14,6 +13,7 @@ class HelloApp(WinForms.Form):
1413
winforms programming and event-based programming in Python."""
1514

1615
def __init__(self):
16+
super().__init__()
1717
self.Text = "Hello World From Python"
1818
self.AutoScaleBaseSize = Size(5, 13)
1919
self.ClientSize = Size(392, 117)

demo/splitter.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import clr
55

66
import System
7+
clr.AddReference("System.Windows.Forms")
78
import System.Windows.Forms as WinForms
89

910
from System.Drawing import Color, Size, Point
@@ -14,6 +15,7 @@ class Splitter(WinForms.Form):
1415
'Creating a Multipane User Interface with Windows Forms'."""
1516

1617
def __init__(self):
18+
super().__init__()
1719

1820
# Create an instance of each control being used.
1921
self.components = System.ComponentModel.Container()
@@ -26,13 +28,13 @@ def __init__(self):
2628

2729
# Set properties of TreeView control.
2830
self.treeView1.Dock = WinForms.DockStyle.Left
29-
self.treeView1.Width = self.ClientSize.Width / 3
31+
self.treeView1.Width = self.ClientSize.Width // 3
3032
self.treeView1.TabIndex = 0
3133
self.treeView1.Nodes.Add("TreeView")
3234

3335
# Set properties of ListView control.
3436
self.listView1.Dock = WinForms.DockStyle.Top
35-
self.listView1.Height = self.ClientSize.Height * 2 / 3
37+
self.listView1.Height = self.ClientSize.Height * 2 // 3
3638
self.listView1.TabIndex = 0
3739
self.listView1.Items.Add("ListView")
3840

@@ -52,7 +54,7 @@ def __init__(self):
5254
self.splitter2.TabIndex = 1
5355

5456
# Set TabStop to false for ease of use when negotiating UI.
55-
self.splitter2.TabStop = 0
57+
self.splitter2.TabStop = False
5658

5759
# Set properties of Form's Splitter control.
5860
self.splitter1.Location = System.Drawing.Point(121, 0)
@@ -61,7 +63,7 @@ def __init__(self):
6163
self.splitter1.TabIndex = 1
6264

6365
# Set TabStop to false for ease of use when negotiating UI.
64-
self.splitter1.TabStop = 0
66+
self.splitter1.TabStop = False
6567

6668
# Add the appropriate controls to the Panel.
6769
for item in (self.richTextBox1, self.splitter2, self.listView1):

demo/wordpad.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import clr
55
import System
6+
clr.AddReference("System.Windows.Forms")
67
import System.Windows.Forms as WinForms
78

89
from System.IO import File
@@ -15,8 +16,9 @@ class Wordpad(WinForms.Form):
1516
"""A simple example winforms application similar to wordpad."""
1617

1718
def __init__(self):
19+
super().__init__()
1820
self.filename = ''
19-
self.word_wrap = 1
21+
self.word_wrap = True
2022
self.doctype = 1
2123
self.InitializeComponent()
2224
self.NewDocument()
@@ -194,10 +196,10 @@ def InitializeComponent(self):
194196
self.richTextBox.Dock = WinForms.DockStyle.Fill
195197
self.richTextBox.Size = System.Drawing.Size(795, 485)
196198
self.richTextBox.TabIndex = 0
197-
self.richTextBox.AutoSize = 1
199+
self.richTextBox.AutoSize = True
198200
self.richTextBox.ScrollBars = WinForms.RichTextBoxScrollBars.ForcedBoth
199201
self.richTextBox.Font = System.Drawing.Font("Tahoma", 10.0)
200-
self.richTextBox.AcceptsTab = 1
202+
self.richTextBox.AcceptsTab = True
201203
self.richTextBox.Location = System.Drawing.Point(0, 0)
202204

203205
self.statusBar.BackColor = System.Drawing.SystemColors.Control
@@ -360,6 +362,7 @@ def SaveChangesDialog(self):
360362

361363
class AboutForm(WinForms.Form):
362364
def __init__(self):
365+
super.__init__()
363366
self.InitializeComponent()
364367

365368
def InitializeComponent(self):

0 commit comments

Comments
 (0)
0