File size: 1,337 Bytes
c0bf168
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import streamlit as st

COPTIC_LETTERS = [
    ['Ⲁ', 'Ⲃ', 'Ⲅ', 'Ⲇ', 'Ⲉ', 'Ⲋ', 'Ⲏ', 'Ⲑ', 'Ⲓ', 'Ⲕ'],
    ['Ⲗ', 'Ⲙ', 'Ⲛ', 'Ⲝ', 'Ⲟ', 'Ⲡ', 'Ⲣ', 'Ⲥ', 'Ⲧ', 'Ⲩ'],
    ['Ⲫ', 'Ⲭ', 'Ⲯ', 'Ⲱ', 'Ϣ', 'Ϥ', 'Ϧ', 'Ϩ', 'Ϫ', 'Ϭ', 'Ϯ'],
    ['ⲁ', 'ⲃ', 'ⲅ', 'ⲇ', 'ⲉ', 'ⲋ', 'ⲏ', 'ⲑ', 'ⲓ', 'ⲕ'],
    ['ⲗ', 'ⲙ', 'ⲛ', 'ⲝ', 'ⲟ', 'ⲡ', 'ⲣ', 'ⲥ', 'ⲧ', 'ⲩ'],
    ['ⲫ', 'ⲭ', 'ⲯ', 'ⲱ', 'ϣ', 'ϥ', 'ϧ', 'ϩ', 'ϫ', 'ϭ', 'ϯ']
]

def coptic_keyboard(target_key):
    if target_key not in st.session_state:
        st.session_state[target_key] = ""
    
    for i, row in enumerate(COPTIC_LETTERS):
        cols = st.columns(len(row))
        for j, letter in enumerate(row):
            with cols[j]:
                if st.button(letter, key=f"kb_{i}_{j}"):
                    st.session_state[target_key] += letter
                    st.rerun()
    
    col1, col2, col3 = st.columns(3)
    with col1:
        if st.button("Space"):
            st.session_state[target_key] += " "
            st.rerun()
    with col2:
        if st.button("⌫"):
            st.session_state[target_key] = st.session_state[target_key][:-1]
            st.rerun()
    with col3:
        if st.button("Clear"):
            st.session_state[target_key] = ""
            st.rerun()