summaryrefslogtreecommitdiff
path: root/Let_us_C_by_Yashavant_P._Kanetkar/chapter-17.ipynb
blob: ea406a32dd65b597476c542f2ce4fe22f690d4a5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
{
 "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": [
      "\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": [
      "\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": [
      "\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": {}
  }
 ]
}