本文整理汇总了Python中System.Windows.Forms.Form.Text方法的典型用法代码示例。如果您正苦于以下问题:Python Form.Text方法的具体用法?Python Form.Text怎么用?Python Form.Text使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Form
的用法示例。
在下文中一共展示了Form.Text方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create_form
# 需要导入模块: from System.Windows.Forms import Form [as 别名]
# 或者: from System.Windows.Forms.Form import Text [as 别名]
def create_form():
f=Form()
f.Text="HelloIronPython"
btn=Button()
btn.Text="ClickMe"
f.Controls.Add(btn)
btn.Top=(f.ClientSize.Height-btn.Height)/2
btn.Left=(f.ClientSize.Width-btn.Width)/2
Application.Run(f)
示例2: import
# 需要导入模块: from System.Windows.Forms import Form [as 别名]
# 或者: from System.Windows.Forms.Form import Text [as 别名]
import clr
clr.AddReference('System.Windows.Forms')
clr.AddReference('System.Drawing')
from System.Windows.Forms import (
Application, Form,
FormBorderStyle, Label
)
from System.Drawing import (
Color, Font, FontStyle, Point
)
form = Form()
form.Text = "Hello World"
form.FormBorderStyle = FormBorderStyle.Fixed3D
form.Height = 150
newFont = Font("Verdana", 16,
FontStyle.Bold | FontStyle.Italic)
label = Label()
label.AutoSize = True
label.Text = "My Hello World Label"
label.Font = newFont
label.BackColor = Color.Aquamarine
label.ForeColor = Color.DarkMagenta
label.Location = Point(10, 50)
form.Controls.Add(label)
Application.Run(form)
示例3: Form
# 需要导入模块: from System.Windows.Forms import Form [as 别名]
# 或者: from System.Windows.Forms.Form import Text [as 别名]
from System.Windows.Forms import Form, Button, Application
from PythonSharp.Utilities import ObjectUtilities
f = Form()
f.Text = "PythonSharp Form"
b = Button()
b.Text = "Hello"
b.Width = 150
b.Height = 50
f.Controls.Add(b)
def click(sender, event):
print("Click")
ObjectUtilities.AddHandler(b, "Click", click, locals())
Application.Run(f)
示例4: draw
# 需要导入模块: from System.Windows.Forms import Form [as 别名]
# 或者: from System.Windows.Forms.Form import Text [as 别名]
def draw(self, show=True, filename=None, update=False, usecoords=False):
"""Create a 2D depiction of the molecule.
Optional parameters:
show -- display on screen (default is True)
filename -- write to file (default is None)
update -- update the coordinates of the atoms to those
determined by the structure diagram generator
(default is False)
usecoords -- don't calculate 2D coordinates, just use
the current coordinates (default is False)
Tkinter and Python Imaging Library are required for image display.
"""
if update:
mol = self.Mol
else:
mol = self.Mol.clone()
if not usecoords:
mol.layout()
if show or filename:
renderer = IndigoRenderer(indigo)
indigo.setOption("render-output-format", "png")
indigo.setOption("render-margins", 10, 10)
indigo.setOption("render-coloring", "True")
indigo.setOption("render-image-size", 300, 300)
indigo.setOption("render-background-color", "1.0, 1.0, 1.0")
if self.title:
indigo.setOption("render-comment", self.title)
if filename:
filedes = None
else:
filedes, filename = tempfile.mkstemp()
renderer.renderToFile(mol, filename)
if show:
if sys.platform[:4] == "java":
image = javax.imageio.ImageIO.read(java.io.File(filename))
frame = javax.swing.JFrame(visible=1)
frame.getContentPane().add(javax.swing.JLabel(javax.swing.ImageIcon(image)))
frame.setSize(300,300)
frame.setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE)
frame.show()
elif sys.platform[:3] == "cli":
if filedes:
errormessage = ("It is only possible to show the molecule if you "
"provide a filename. The reason for this is that I kept "
"having problems when using temporary files.")
raise RuntimeError(errormessage)
form = Form()
form.ClientSize = Size(300, 300)
form.Text = self.title
image = Image.FromFile(filename)
box = PictureBox()
box.SizeMode = PictureBoxSizeMode.StretchImage
box.Image = image
box.Dock = DockStyle.Fill
form.Controls.Add(box)
form.Show()
Application.Run(form)
else:
if not PILtk:
errormessage = ("Tkinter or Python Imaging "
"Library not found, but is required for image "
"display. See installation instructions for "
"more information.")
raise ImportError, errormessage
root = tk.Tk()
root.title((hasattr(self, "title") and self.title)
or self.__str__().rstrip())
frame = tk.Frame(root, colormap="new", visual='truecolor').pack()
image = PIL.open(filename)
imagedata = PILtk.PhotoImage(image)
label = tk.Label(frame, image=imagedata).pack()
quitbutton = tk.Button(root, text="Close", command=root.destroy).pack(fill=tk.X)
root.mainloop()
if filedes:
os.close(filedes)
os.remove(filename)
示例5: import
# 需要导入模块: from System.Windows.Forms import Form [as 别名]
# 或者: from System.Windows.Forms.Form import Text [as 别名]
import sys
import clr
clr.AddReference('System.Drawing')
clr.AddReference('System.Windows.Forms')
clr.AddReference('Microsoft.Ink, Version=1.7.2600.2180, Culture=neutral, PublicKeyToken=31bf3856ad364e35')
from System.Drawing import Font, Color
from System.Windows.Forms import (Form, DockStyle, Panel, TextBox, Button,
SplitContainer, Orientation)
from Microsoft.Ink import InkOverlay
f = Form()
f.Text = 'InkOverlay Example'
btn = Button()
btn.Text = 'Erase'
pnl = Panel()
pnl.BackColor = Color.Khaki
overlay = InkOverlay(pnl)
overlay.Enabled = True
tb = TextBox()
tb.Font = Font('serif', 20)
tb.Multiline = True
sc = SplitContainer()
sc.SplitterWidth = 10
sc.Orientation = Orientation.Horizontal
# Layout
f.Width = 600
示例6: ModuleInfoDialog
# 需要导入模块: from System.Windows.Forms import Form [as 别名]
# 或者: from System.Windows.Forms.Form import Text [as 别名]
# ------------------------------------------------------------------
class ModuleInfoDialog(Form):
def __init__(self, docs):
Form.__init__(self)
self.ClientSize = Size(400, 400)
self.Text = "Module Details"
self.Icon = Icon(UIGlobal.ApplicationIcon)
infoPane = ModuleInfoPane()
infoPane.SetFromDocs(docs)
self.Controls.Add(infoPane)
# ------------------------------------------------------------------
if __name__ == "__main__":
import FTModules
mm = FTModules.ModuleManager()
mm.LoadAll()
mb = ModuleBrowser(mm)
form = Form()
form.ClientSize = Size(500, 300)
form.Text = "Test of Module Browser"
form.Controls.Add(mb)
Application.Run(form)
示例7: __OnLoad
# 需要导入模块: from System.Windows.Forms import Form [as 别名]
# 或者: from System.Windows.Forms.Form import Text [as 别名]
self.FormClosing += self.__OnFormClosing
def __OnLoad(self, sender, event):
self.cmPanel.SetFocusOnCurrentCollection()
def __OnCollectionActivated(self, collectionName):
# make selection available to caller
self.activatedCollection = collectionName
self.Close()
def __OnFormClosing(self, sender, event):
self.activatedCollection = self.cmPanel.currentCollection
self.cmPanel.SaveAll()
# ------------------------------------------------------------------
if __name__ == "__main__":
collections = FTCollections.CollectionsManager()
mm = FTModules.ModuleManager()
mm.LoadAll()
cmPanel = CollectionsManagerUI(collections, mm, None)
form = Form()
form.ClientSize = Size(600, 550)
form.Text = "Test of Collections Manager"
form.Controls.Add(cmPanel)
Application.Run(form)
示例8: main
# 需要导入模块: from System.Windows.Forms import Form [as 别名]
# 或者: from System.Windows.Forms.Form import Text [as 别名]
def main():
f=Form()
f.Text="HelloIronPython"
Application.Run(f)