Window creation: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
Line 21: Line 21:


import tkinter
import tkinter

w = tkinter.Tk()
w = tkinter.Tk()
w.mainloop()
w.mainloop()
Line 28: Line 28:


from wxPython.wx import *
from wxPython.wx import *

class MyApp(wxApp):
class MyApp(wxApp):
def OnInit(self):
def OnInit(self):
Line 35: Line 35:
self.SetTopWindow(frame)
self.SetTopWindow(frame)
return true
return true

app = MyApp(0)
app = MyApp(0)
app.MainLoop()
app.MainLoop()
Line 43: Line 43:
import win32ui
import win32ui
from pywin.mfc.dialog import Dialog
from pywin.mfc.dialog import Dialog

d = Dialog(win32ui.IDD_SIMPLE_INPUT)
d = Dialog(win32ui.IDD_SIMPLE_INPUT)
d.CreateWindow()
d.CreateWindow()

Revision as of 16:55, 21 January 2007

Task
Window creation
You are encouraged to solve this task according to the task description, using any language you may know.

mIRC

Compiler: mIRC

Switches: C = Center Window p = Picture Window d = Desktop Window

alias CreateMyWindow {
 .window -Cp +d @WindowName 600 480
}

Python

Interpreter: Python 2.4, 2.5

Using Tkinter:

 import tkinter
 
 w = tkinter.Tk()
 w.mainloop()

Using wxPython:

 from wxPython.wx import *
 
 class MyApp(wxApp):
   def OnInit(self):
     frame = wxFrame(NULL, -1, "Hello from wxPython")
     frame.Show(true)
     self.SetTopWindow(frame)
     return true
 
 app = MyApp(0)
 app.MainLoop()

Using Pythonwin:

 import win32ui
 from pywin.mfc.dialog import Dialog
 
 d = Dialog(win32ui.IDD_SIMPLE_INPUT)
 d.CreateWindow()