Skip to content

Fix demo scripts #1802

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions demo/helloform.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

import clr

SWF = clr.AddReference("System.Windows.Forms")
print (SWF.Location)
clr.AddReference("System.Windows.Forms")
import System.Windows.Forms as WinForms
from System.Drawing import Size, Point

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

def __init__(self):
super().__init__()
self.Text = "Hello World From Python"
self.AutoScaleBaseSize = Size(5, 13)
self.ClientSize = Size(392, 117)
Expand Down
10 changes: 6 additions & 4 deletions demo/splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import clr

import System
clr.AddReference("System.Windows.Forms")
import System.Windows.Forms as WinForms

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

def __init__(self):
super().__init__()

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

# Set properties of TreeView control.
self.treeView1.Dock = WinForms.DockStyle.Left
self.treeView1.Width = self.ClientSize.Width / 3
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.Height = self.ClientSize.Height * 2 // 3
self.listView1.TabIndex = 0
self.listView1.Items.Add("ListView")

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

# Set TabStop to false for ease of use when negotiating UI.
self.splitter2.TabStop = 0
self.splitter2.TabStop = False

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

# Set TabStop to false for ease of use when negotiating UI.
self.splitter1.TabStop = 0
self.splitter1.TabStop = False

# Add the appropriate controls to the Panel.
for item in (self.richTextBox1, self.splitter2, self.listView1):
Expand Down
9 changes: 6 additions & 3 deletions demo/wordpad.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import clr
import System
clr.AddReference("System.Windows.Forms")
import System.Windows.Forms as WinForms

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

def __init__(self):
super().__init__()
self.filename = ''
self.word_wrap = 1
self.word_wrap = True
self.doctype = 1
self.InitializeComponent()
self.NewDocument()
Expand Down Expand Up @@ -194,10 +196,10 @@ def InitializeComponent(self):
self.richTextBox.Dock = WinForms.DockStyle.Fill
self.richTextBox.Size = System.Drawing.Size(795, 485)
self.richTextBox.TabIndex = 0
self.richTextBox.AutoSize = 1
self.richTextBox.AutoSize = True
self.richTextBox.ScrollBars = WinForms.RichTextBoxScrollBars.ForcedBoth
self.richTextBox.Font = System.Drawing.Font("Tahoma", 10.0)
self.richTextBox.AcceptsTab = 1
self.richTextBox.AcceptsTab = True
self.richTextBox.Location = System.Drawing.Point(0, 0)

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

class AboutForm(WinForms.Form):
def __init__(self):
super.__init__()
self.InitializeComponent()

def InitializeComponent(self):
Expand Down