Fouzanjaved commited on
Commit
4478a31
·
verified ·
1 Parent(s): 8a61d51

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -42
app.py CHANGED
@@ -1,48 +1,14 @@
1
  import streamlit as st
2
  import streamlit.components.v1 as components
3
 
4
- html_code = '''
5
- <!DOCTYPE html>
6
- <html lang="en">
7
- <head>
8
- <meta charset="UTF-8">
9
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
10
- <title>Complex Calculator</title>
11
- <style>
12
- /* CSS code from style.css */
13
- </style>
14
- </head>
15
- <body>
16
- <div class="calculator">
17
- <div class="display" id="display">0</div>
18
- <div class="buttons">
19
- <button class="btn" onclick="clearDisplay()">C</button>
20
- <button class="btn" onclick="deleteLast()">DEL</button>
21
- <button class="btn" onclick="appendOperator('%')">%</button>
22
- <button class="btn operator" onclick="appendOperator('/')">/</button>
23
- <button class="btn" onclick="appendNumber('7')">7</button>
24
- <button class="btn" onclick="appendNumber('8')">8</button>
25
- <button class="btn" onclick="appendNumber('9')">9</button>
26
- <button class="btn operator" onclick="appendOperator('*')">*</button>
27
- <button class="btn" onclick="appendNumber('4')">4</button>
28
- <button class="btn" onclick="appendNumber('5')">5</button>
29
- <button class="btn" onclick="appendNumber('6')">6</button>
30
- <button class="btn operator" onclick="appendOperator('-')">-</button>
31
- <button class="btn" onclick="appendNumber('1')">1</button>
32
- <button class="btn" onclick="appendNumber('2')">2</button>
33
- <button class="btn" onclick="appendNumber('3')">3</button>
34
- <button class="btn operator" onclick="appendOperator('+')">+</button>
35
- <button class="btn zero" onclick="appendNumber('0')">0</button>
36
- <button class="btn" onclick="appendNumber('.')">.</button>
37
- <button class="btn equals" onclick="calculateResult()">=</button>
38
- </div>
39
- </div>
40
- <script>
41
- /* JavaScript code from script.js */
42
- </script>
43
- </body>
44
- </html>
45
- '''
46
 
47
  components.html(html_code, height=600)
48
 
 
1
  import streamlit as st
2
  import streamlit.components.v1 as components
3
 
4
+ # Read HTML, CSS, and JS files
5
+ html_content = read_file('index.html')
6
+ css_content = '<style>' + read_file('style.css') + '</style>'
7
+ js_content = '<script>' + read_file('script.js') + '</script>'
8
+
9
+ # Combine the content
10
+ complete_html = html_content.replace('<link rel="stylesheet" href="style.css">', css_content)
11
+ complete_html = complete_html.replace('<script src="script.js"></script>', js_content)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
  components.html(html_code, height=600)
14