Skip to content

Instantly share code, notes, and snippets.

@the-byte-bender
Last active October 19, 2024 19:35
Show Gist options
  • Select an option

  • Save the-byte-bender/53a39983d8d66ffa7ed88f68806cd14f to your computer and use it in GitHub Desktop.

Select an option

Save the-byte-bender/53a39983d8d66ffa7ed88f68806cd14f to your computer and use it in GitHub Desktop.
quickly access English phonemes in IPA, grab the one you need mid-writing, and paste it directly.
import wx
import pyperclip
class IPASelector(wx.Frame):
def __init__(self):
super().__init__(parent=None, title="IPA Selector")
panel = wx.Panel(self)
self.ipa_symbols = [
"i",
"ɪ",
"e",
"ɛ",
"æ",
"a",
"ə",
"ɨ",
"ɚ",
"ɝ",
"aɪ",
"aʊ",
"ɔɪ",
"ju",
"p",
"b",
"t",
"d",
"k",
"ɡ",
"f",
"v",
"θ",
"ð",
"s",
"z",
"ʃ",
"ʒ",
"h",
"tʃ",
"dʒ",
"m",
"n",
"ŋ",
"ʒ",
"l",
"ɹ",
"j",
"w",
"ɾ",
]
self.list_box = wx.ListBox(panel, choices=self.ipa_symbols, style=wx.LB_SINGLE)
self.list_box.Bind(wx.EVT_LISTBOX_DCLICK, self.on_dclick)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.list_box, 0, wx.ALL | wx.EXPAND, 5)
panel.SetSizer(sizer)
self.SetSize((200, 300))
self.Centre()
def on_dclick(self, event):
selected_symbol = self.list_box.GetStringSelection()
pyperclip.copy(selected_symbol)
self.Close()
if __name__ == "__main__":
app = wx.App()
frame = IPASelector()
frame.Show()
app.MainLoop()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment