From 6c16868fdc1c277223b944de8a7b547779404992 Mon Sep 17 00:00:00 2001 From: Benedikt Reinartz Date: Mon, 30 May 2022 00:23:00 +0200 Subject: [PATCH] Fix demo scripts --- demo/helloform.py | 4 ++-- demo/splitter.py | 10 ++++++---- demo/wordpad.py | 9 ++++++--- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/demo/helloform.py b/demo/helloform.py index 6e404771a..503d1c8b5 100644 --- a/demo/helloform.py +++ b/demo/helloform.py @@ -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 @@ -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) diff --git a/demo/splitter.py b/demo/splitter.py index 126499db6..c209de6ab 100644 --- a/demo/splitter.py +++ b/demo/splitter.py @@ -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 @@ -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() @@ -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") @@ -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) @@ -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): diff --git a/demo/wordpad.py b/demo/wordpad.py index 409c8ad4d..b0666024a 100644 --- a/demo/wordpad.py +++ b/demo/wordpad.py @@ -3,6 +3,7 @@ import clr import System +clr.AddReference("System.Windows.Forms") import System.Windows.Forms as WinForms from System.IO import File @@ -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() @@ -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 @@ -360,6 +362,7 @@ def SaveChangesDialog(self): class AboutForm(WinForms.Form): def __init__(self): + super.__init__() self.InitializeComponent() def InitializeComponent(self): pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy