Skip to content

Commit

Permalink
Investigating #434
Browse files Browse the repository at this point in the history
Updated textAreas, to allow editing even when disabled.
  • Loading branch information
jarvisteach committed Apr 12, 2018
1 parent f71710b commit a7f02c3
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
10 changes: 9 additions & 1 deletion appJar/appjar.py
Expand Up @@ -8768,7 +8768,7 @@ def setTextAreaFont(self, title, **kwargs):
""" changes the font of a text area """
self.widgetManager.get(self.Widgets.TextArea, title).setFont(**kwargs)

def setTextArea(self, title, text, end=True, callFunction=True):
def setTextArea(self, title, text, end=True, callFunction=True, override=True):
""" Add the supplied text to the specified TextArea

:param title: the TextArea to change
Expand All @@ -8781,10 +8781,18 @@ def setTextArea(self, title, text, end=True, callFunction=True):
ta = self.widgetManager.get(self.Widgets.TextArea, title)

ta.pauseCallFunction(callFunction)

if override:
_state = ta.cget('state')
ta.config(state='normal')

if end:
ta.insert(END, text)
else:
ta.insert('1.0', text)

if override: ta.config(state=_state)

ta.resumeCallFunction()

def clearTextArea(self, title, callFunction=True):
Expand Down
16 changes: 16 additions & 0 deletions examples/issues/issue434.py
@@ -0,0 +1,16 @@
import sys
sys.path.append("../../")

from appJar import gui

def process():
c = app.entry("command")
if c.lower().strip().startswith("bg"):
col = c.split("=")[1].strip()
app.bg = col
app.text('text', "BG set to: " + col + "\n", bg=col)


with gui("Translator", "600x400", bg="black") as app:
app.text("text", border=1, relief='sunken', state='disabled')
app.entry("command", submit=process, focus=True)

0 comments on commit a7f02c3

Please sign in to comment.