Python 3 and ktinter

Mike Enoch's Avatar

Mike Enoch

12 Nov, 2016 11:54 AM

I'm trying to write an extension using Python 3 and the ktinter module. However when I run it in the Python Interpreter I get the following error message:

Error running script: Traceback (most recent call last):
  File "C:\Users\2M\Desktop\Program ming\Moneydance Window.py", line 1, in <module>
    from tkinter import *
ImportError: No module named tkinter

Is there any way I can proceed?

  1. Support Staff 1 Posted by Sean Reilly on 12 Nov, 2016 09:32 PM

    Sean Reilly's Avatar

    Hi Mike,

    Ah yes, tkinter won't be available since the Python interpreter used in Moneydance is Jython - the java-based interpreter. My understanding is that the tk library isn't available on the Jython platform. If that's not true please let me know and I can look into ensuring that the tkinter libraries can be bundled with the next update.

    Thanks!
    Sean

  2. 2 Posted by Mike Enoch on 14 Nov, 2016 01:21 PM

    Mike Enoch's Avatar

    Thanks for the info. You're correct the tk library isn't available on Jython.

    So it's back to the textbooks and another learning curve for me to climb!

  3. Support Staff 3 Posted by Sean Reilly on 14 Nov, 2016 03:53 PM

    Sean Reilly's Avatar

    Yes, sorry about that. Please let me know though what kind of UI interface would be use. We do need to keep it cross-platform, but maybe something like simple HTML would be useful?

    We're also working on an interface to interface with user authentication/authorisation such as for online banking logins, in case that's what you're looking for.

    Thanks,
    Sean

  4. 4 Posted by Mike Enoch on 15 Nov, 2016 12:27 PM

    Mike Enoch's Avatar

    I'm attempting to write an extension (basically for my own use
    initially) that would list all Transaction Reminders in a table,
    showing:

    Start Date; Payee; Last Date Paid; Next Date Due; Amount; From Account;
    To Account.

    When particular line is clicked the Edit Transaction Reminder Form
    should be displayed. On closure the table would be refreshed.

    I've got many years experience of Microsoft Visual Basic and have a
    limited knowledge of Python, so Jython and Swing are very new to me.
    (I've ordered books!!)

    Would you be able to give me advice on the code required to display the
    edit-reminders window.

  5. 5 Posted by Mike Enoch on 17 Nov, 2016 05:58 PM

    Mike Enoch's Avatar

    Edit Transaction Reminder

  6. Support Staff 6 Posted by Sean Reilly on 17 Nov, 2016 08:38 PM

    Sean Reilly's Avatar

    Hi Mike,

    Great question. This is currently only accessible with the following code:

    from com.moneydance.apps.md.view.gui import EditRemindersWindow
    reminders = moneydance_data.getReminders()
    reminder = reminders.getAllReminders()[0]
    EditRemindersWindow.editReminder(None, moneydance_ui, reminder)
    

    I'll add a more formal interface to do something like this to a future version.

    Thanks!

    Sean Reilly
    Developer, The Infinite Kind
    http://infinitekind.com

  7. 7 Posted by Mike Enoch on 19 Nov, 2016 07:23 PM

    Mike Enoch's Avatar

    Thank you for the code.

    I've now got most of the extension sorted but I can't see how to get the Account Name that the funds, for each Transaction Reminder, are taken from.

    Any advice most welcome.

  8. Support Staff 8 Posted by Sean Reilly on 19 Nov, 2016 07:40 PM

    Sean Reilly's Avatar

    Hi Mike,

    Ah, to get the account for the transaction reminder you’ll just need to call .getTransaction() on the reminder to get a ParentTxn object. On the parent transaction you can call .getAccount() to get the account object that contains that transaction, and then getOtherTxn(i).getAccount() for i=[0…txn.getOtherTxCount()).

    Thanks! Sean

  9. 9 Posted by Mike Enoch on 28 Nov, 2016 07:42 PM

    Mike Enoch's Avatar

    Could you advise me how to show the Reminder Notification window?

    Thanks

    Mike

  10. System closed this discussion on 27 Feb, 2017 07:50 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac