HTML Window moveTo() Method

AmitDiwan
Updated on 01-Oct-2019 11:34:54

144 Views

The HTML Window moveTo() method moves a window’s left and top edges to the specified coordinates.SyntaxFollowing is the syntax −window.moveTo(x, y)Here, x and y define the value of moving the window horizontally and vertically in pixels respectively.Let us see an example of HTML Window moveTo() Method −Example Live Demo    body {       color: #000;       height: 100vh;       background-color: #8BC6EC;       background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%) no-repeat;       text-align: center;    }    .btn {       background: #db133a;       border: none;     ... Read More

HTML Window moveBy() Method

AmitDiwan
Updated on 01-Oct-2019 11:33:02

87 Views

The HTML Window moveBy() method moves the window relative to its current coordinates.SyntaxFollowing is the syntax −window.moveBy(x, y)Here, x and y define the value of moving the window horizontally and vertically in pixels respectively.Let us see an example of HTML Window moveBy() Method −Example Live Demo    body {       color: #000;       height: 100vh;       background-color: #8BC6EC;       background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%) no-repeat;       text-align: center;    }    .btn {       background: #db133a;       border: none;       height: 2rem; ... Read More

What does open() function do in Python?

Manogna
Updated on 01-Oct-2019 11:30:05

141 Views

The function open() opens a file. You can use it like: f = open('my_file', 'r+') my_file_data = f.read() f.close() The above code opens 'my_file'in read mode then stores the data it reads from my_file in my_file_data and closes the file. The first argument of open is the name of the file and second one is the open mode. It determines how the file gets opened, for example,  – If you want to read the file, pass in r– If you want to read and writethe file, pass in r+– If you want to overwrite thefile, pass in w– If you want to ... Read More

What does close() function do in Python?

Manogna
Updated on 01-Oct-2019 11:29:19

232 Views

The function close() closes an open file. For example: f = open('my_file', 'r+') my_file_data = f.read() f.close() The above code opens 'my_file'in read mode then stores the data it reads from my_file in my_file_data and closes the file. When you open a file, the operating system gives a file handle to read/write the file. You need to close it once you are done using the file. If your program encounters an error and doesn't call f.close(), you didn't release the file. To make sure it doesn't happen, you can use with open(...) as syntax as it automatically closes files regardless of whether ... Read More

HTML Window pageYOffset Property

AmitDiwan
Updated on 01-Oct-2019 11:28:35

259 Views

The HTML Window pageYOffset property returns the value in pixel the current document has been scrolled vertically from the left corner.SyntaxFollowing is the syntax −window.pageYOffsetLet us see an example of HTML Window pageYOffset Property −Example Live Demo    body {       color: #000;       height: 100vh;       background-color: #8BC6EC;       background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%) no-repeat;       text-align: center;    }    .btn {       background: #db133a;       border: none;       height: 2rem;       border-radius: 2px;       width: ... Read More

How to make unique objects accessible in other modules of Python?

Rajendra Dharmkar
Updated on 01-Oct-2019 11:28:14

220 Views

This is basically the idea of a singleton object. So if you have instantiated an obect and want to access it across different module, you can use 2 approaches, first being you assign that variable to the module you imported under a variable name. For example, you have a object myobj instantiated and want to use it with module B, then you can do the following:>>> import B >>> B.myobj = myobjAnd inside module B, use it like any other global property. Another way is to accept this object as a parameter wherever required. For example, if you have a ... Read More

How do I import all the submodules of a Python namespace package?

Rajendra Dharmkar
Updated on 01-Oct-2019 11:25:13

488 Views

The "from module import *" statement is used to import all submodules from a Python package/module. For example, if you want to import all modules from your module(say nyModule) and do not want to prefix "myModule." while calling them, you can do it as follows:>>> from myModule import *Note that for any reasonable large set of code, if you import * you will likely be cementing it into the module, unable to be removed. This is because it is difficult to determine what items used in the code are coming from 'module', making it easy to get to the point ... Read More

HTML Window pageXOffset Property

AmitDiwan
Updated on 01-Oct-2019 11:24:46

73 Views

The HTML Window pageXOffset property returns the value in pixel the current document has been scrolled horizontally from the left corner.SyntaxFollowing is the syntax −window.pageXOffsetLet us see an example of HTML Window pageXOffset Property −Example Live Demo    body {       color: #000;       height: 100vh;       background-color: #8BC6EC;       background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%) no-repeat;       text-align: center;    }    .btn {       background: #db133a;       border: none;       height: 2rem;       border-radius: 2px;       width: ... Read More

Explain the visibility of global variables in imported modules in Python?

Rajendra Dharmkar
Updated on 01-Oct-2019 11:24:41

831 Views

Globals in Python are global to a module, not across all modules. (Unlike C, where a global is the same across all implementation files unless you explicitly make it static.). If you need truly global variables from imported modules, you can set those at an attribute of the module where you're importing it.import module1 module1.a=3On the other hand, if a is shared by a whole lot of modules, put it somewhere else, and have everyone import it:global_module.py module1.py: import global_module def fun():     print global_module.var Other files: import global_module import module1 global_module.var = 3 module1.fun()Read More

HTML Window screenY Property

AmitDiwan
Updated on 01-Oct-2019 11:21:30

70 Views

The HTML Window screenY property returns the horizontal coordinates of the window relative to the screen. It is supported by all browsers.SyntaxFollowing is the syntax −window.screenYLet us see an example of HTML Window screenY Property −Example Live Demo    body {       color: #000;       height: 100vh;       background-color: #8BC6EC;       background-image: linear-gradient(135deg, #8BC6EC 0%, #9599E2 100%);       text-align: center;    }    .btn {       background: #db133a;       border: none;       height: 2rem;       border-radius: 2px;       width: ... Read More

Advertisements