diff options
author | Jovina Dsouza | 2014-06-18 12:43:07 +0530 |
---|---|---|
committer | Jovina Dsouza | 2014-06-18 12:43:07 +0530 |
commit | 206d0358703aa05d5d7315900fe1d054c2817ddc (patch) | |
tree | f2403e29f3aded0caf7a2434ea50dd507f6545e2 /Let_us_C/chapter-17.ipynb | |
parent | c6f0d6aeb95beaf41e4b679e78bb42c4ffe45a40 (diff) | |
download | Python-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.tar.gz Python-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.tar.bz2 Python-Textbook-Companions-206d0358703aa05d5d7315900fe1d054c2817ddc.zip |
adding book
Diffstat (limited to 'Let_us_C/chapter-17.ipynb')
-rw-r--r-- | Let_us_C/chapter-17.ipynb | 115 |
1 files changed, 115 insertions, 0 deletions
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": [
+ "<h1>Chapter 17: Windows Programming<h1>"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "metadata": {},
+ "source": [
+ "<h3>Message Box, Page number: 563<h3>"
+ ]
+ },
+ {
+ "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": [
+ "<h3>More Windows, Page number: 566<h3>"
+ ]
+ },
+ {
+ "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": [
+ "<h3>A Real World Window, Page number: 568<h3>"
+ ]
+ },
+ {
+ "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 |