Skip to content

Commit 314b7d3

Browse files
committed
All packages moved to docs folder
1 parent ba53aba commit 314b7d3

11 files changed

Lines changed: 70 additions & 154 deletions
File renamed without changes.

Packages/Matplotlib/Doubly Reinforced Concrete Beam - Google Colab Code Breakdown.ipynb renamed to Jupyternotebook Sample/Doubly Reinforced Concrete Beam - Google Colab Code Breakdown.ipynb

File renamed without changes.

Packages/OpenPyXL/Create excel file.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

Packages/OpenPyXL/Overwrite Excel file.md

Lines changed: 0 additions & 24 deletions
This file was deleted.

Packages/OpenPyXL/Read Excel File.md

Lines changed: 0 additions & 89 deletions
This file was deleted.

Packages/Tkinter/Fun Fact Generator.md

Lines changed: 0 additions & 26 deletions
This file was deleted.
File renamed without changes.
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,44 @@
1+
### Sample Code to create new excel file
2+
```python
3+
from openpyxl import Workbook
4+
5+
wb=Workbook()
6+
wb.create_sheet("Test")
7+
8+
ws=wb["Test"]
9+
10+
for i in range(1,11):
11+
ws.cell(i,1).value=i
12+
ws.cell(i,2).value="=A"+str(i)+ "*2"
13+
14+
wb.save(filename="output.xlsx")
15+
```
16+
17+
### Sample code to add new sheet to exising one
18+
```python
19+
import openpyxl
20+
21+
# Load Excel file
22+
wb=openpyxl.load_workbook("Sample.xlsx")
23+
24+
# Write new sheet
25+
wb.create_sheet("Test")
26+
27+
# Save workbook, you can overwrite existing file if you want to
28+
wb.save("New File.xlsx")
29+
```
30+
```python
31+
# Write new sheet with Specific Position, 0=first sheet
32+
wb.create_sheet("Test",0)
33+
```
34+
### Overwrite specific Cell
35+
```python
36+
# Overwrite data in existing sheet
37+
ws=wb["Sheet1"]
38+
ws["A1"].value="Test"
39+
ws.cell(1,2).value="cool book names"
40+
```
41+
142
### Cell formatting
243
```python
344
import openpyxl
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,30 @@ ok_button.pack(padx=10, pady=10)
8484
# this is require to keep window running
8585
window.mainloop()
8686
```
87+
88+
### Script
89+
```python
90+
import json
91+
import requests # pip install requests
92+
from tkinter import *
93+
94+
def get_fun_fact():
95+
url ="https://uselessfacts.jsph.pl/api/v2/facts/random?language=en"
96+
response = requests.request("GET", url)
97+
data = json.loads(response.text)
98+
useless_fact = data['text']
99+
print(useless_fact)
100+
lbl.configure(text=useless_fact)
101+
102+
window=Tk()
103+
window.title("Fun Fact Generator")
104+
window.geometry("800x80")
105+
106+
btn=Button(window,text="Click Me",command=get_fun_fact)
107+
btn.pack()
108+
109+
lbl=Label(window,text="Click the button to get random fact")
110+
lbl.pack()
111+
112+
window.mainloop()
113+
```

0 commit comments

Comments
 (0)