File size: 2,753 Bytes
1cfeee0
 
2a9c36f
ce7d966
1cfeee0
 
c44bc38
1cfeee0
 
 
 
ce7d966
669fd47
1cfeee0
669fd47
 
1cfeee0
669fd47
 
d470bb8
426f2d7
07a2b88
316ff75
3ed26c7
 
ee7ec7b
ac6498d
 
ee7ec7b
 
c115180
 
 
 
1cfeee0
669fd47
 
1cfeee0
 
 
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
import streamlit as st

st.set_page_config(layout="wide")
default_language_index = 3
# Dropdown menu for selecting a programming language
language = st.selectbox("Pick a Programming Language:", 
                        ["C", "C++", "C#", "Python","Python Console", "Jupyter Notebooks", "Ipython Notebook" ,"HTML/CSS/JS"],  index=default_language_index)

# Function to render markdown content with unsafe HTML based on the selected language
def render_language_content(selected_language):
    if selected_language == "C":
        website_url = "https://www.jdoodle.com/ia/1eQm"
        st.components.v1.html(f"""<iframe src="{website_url}" width="100%" height="700px" frameborder="0"></iframe>""",height=700,)
    elif selected_language == "C++":
        website_url = "https://www.jdoodle.com/ia/1eQj"
        st.components.v1.html(f"""<iframe src="{website_url}" width="100%" height="700px" frameborder="0"></iframe>""",height=700,)
    elif selected_language == "C#":
        website_url = "https://www.jdoodle.com/ia/1eQk"
        st.components.v1.html(f"""<iframe src="{website_url}" width="100%" height="700px" frameborder="0"></iframe>""",height=700,)
    elif selected_language == "Python":
        website_url = "https://www.jdoodle.com/ia/1eQe"
        st.components.v1.html(f"""<iframe src="{website_url}" width="100%" height="700px" frameborder="0"></iframe>""",height=700,)
    elif selected_language == "Python(CodeHS)":
        st.markdown("""<iframe width="1700" height="700" src="https://codehs.com/sandbox/id/python-3-byxftG/embed/?display_mode=default&read_only=True" frameborder="0" allowfullscreen class="video-iframe"></iframe>""", 
                    unsafe_allow_html=True)
    elif selected_language == "Python Console":
        st.markdown("""<iframe src="https://jupyterlite.github.io/demo/repl/index.html?kernel=python&toolbar=1" width="100%" height="700px"></iframe>""", 
                    unsafe_allow_html=True)
    elif selected_language == "Jupyter Notebooks":
        website_url = "https://jupyter.org/try"
        st.components.v1.html(f"""<iframe src="{website_url}" width="100%" height="700px" frameborder="0"></iframe>""", height=700)
    elif selected_language == "Ipython Notebook":
        website_url = "https://jupyterlite.github.io/demo/lab/index.html"
        st.components.v1.html(f"""<iframe src="{website_url}" width="100%" height="700px" frameborder="0"></iframe>""", height=700)
    elif selected_language == "HTML/CSS/JS":
        website_url = "https://www.jdoodle.com/ih/1eQl"
        st.components.v1.html(f"""<iframe src="{website_url}" width="100%" height="1000px" frameborder="0"></iframe>""",height=1000,)

# Call the function to render the selected content
render_language_content(language)