From 206d0358703aa05d5d7315900fe1d054c2817ddc Mon Sep 17 00:00:00 2001 From: Jovina Dsouza Date: Wed, 18 Jun 2014 12:43:07 +0530 Subject: adding book --- Let_us_C/chapter-17.ipynb | 115 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 Let_us_C/chapter-17.ipynb (limited to 'Let_us_C/chapter-17.ipynb') diff --git a/Let_us_C/chapter-17.ipynb b/Let_us_C/chapter-17.ipynb new file mode 100644 index 00000000..1b6a9007 --- /dev/null +++ b/Let_us_C/chapter-17.ipynb @@ -0,0 +1,115 @@ +{ + "metadata": { + "name": "chapter-17.ipynb" + }, + "nbformat": 3, + "nbformat_minor": 0, + "worksheets": [ + { + "cells": [ + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Chapter 17: Windows Programming

" + ] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

Message Box, Page number: 563

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''Program to create a window on the screen.'''\n", + "\n", + "from tkinter import *\n", + "\n", + "\n", + "#creating window\n", + "root = Tk()\n", + "root.title(\"Press Me\")\n", + "button1 = Button(root, text=\"Press Me\") #creating button\n", + "button1.pack()\n", + "import ctypes #creating message box\n", + "MessageBox = ctypes.windll.user32.MessageBoxW\n", + "MessageBox(None, 'Hi!', 'Waiting', 0)\n", + "root.mainloop()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

More Windows, Page number: 566

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''Program to create several windows on the screen'''\n", + "\n", + "from tkinter import *\n", + "root = []\n", + "#creating windows\n", + "for x in range(0,10):\n", + " root.append(Tk())\n", + " root[x].title(\"Press Me\")\n", + " button1 = Button(root[x], text=\"Press Me\") #creating button\n", + " button1.pack()\n", + " \n", + "import ctypes #creating message box\n", + "MessageBox = ctypes.windll.user32.MessageBoxW\n", + "MessageBox(None, 'Hi!', 'Waiting', 0)\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + }, + { + "cell_type": "markdown", + "metadata": {}, + "source": [ + "

A Real World Window, Page number: 568

" + ] + }, + { + "cell_type": "code", + "collapsed": false, + "input": [ + "'''Program to create a window using window class and interact with it'''\n", + "\n", + "from tkinter import *\n", + "\n", + "\n", + "class Example(Frame):\n", + " def __init__(self, parent):\n", + " Frame.__init__(self, parent)\n", + "\n", + " self.display = Canvas(self, width=700, height=200)\n", + " self.display.pack(side=\"top\", fill=\"both\", expand=True)\n", + " \n", + "if __name__ == \"__main__\":\n", + " root = Tk()\n", + " root.title(\"Title\")\n", + " Frame = Example(parent=root)\n", + " Frame.pack(side=\"top\", fill=\"both\", expand=True)\n", + " root.mainloop()\n" + ], + "language": "python", + "metadata": {}, + "outputs": [] + } + ], + "metadata": {} + } + ] +} \ No newline at end of file -- cgit