Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6477023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T06:53:50+00:00 2026-05-25T06:53:50+00:00

I have created some Python code which is really complicated but it basically asks

  • 0

I have created some Python code which is really complicated but it basically asks for an input and then outputs a huge DNA sequence depending on the input given, along with some graphs and many equations. I would like to embed this code into the user interface that I will most likely make with wxPython or Tkinter. I don’t understand how to plug my code into the user interface. Please Help! Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T06:53:51+00:00Added an answer on May 25, 2026 at 6:53 am

    The GUI will be handling both your input and output. So if your code is currently a big, long script that reads from and writes to the console, the first thing you’ll want to do is refactor it into a class or set of standalone functions (depending on your code) that take the input as arguments, and return the results. If you write it properly, you can even keep your console application while making the class or functions available for other applications to import.

    Pseudocode example:

    # stuff.py
    
    class StuffDoer:
        def __init__(self, val1, val2, ...):
            self.val1 = val1
            self.val2 = val2
    
        def calculate_sequence(self):
            # do some stuff
            return sequence
    
        def create_graph(self, target_folder):
            # generate the graph and save it
            return path_to_graph
    
    if __name__ == '__main__':
        # the console interface
        val1 = raw_input('Enter value 1:')
        val2 = raw_input('Enter value 2:')
    
        s = StuffDoer(val1, val2)
        seq = s.calculate_sequence()
        print('Sequence: %s' % seq)
        path = s.create_graph('/temp')
        print('Wrote graph to %s' % path)
    

    You may already know this, but the code inside if __name__ == '__main__': will only be executed if you run the module directly. If you instead import stuff from another module (like your GUI code), you’ll just have access to the definition of the stuff.StuffDoer class.

    Here’s an example of what happens in the GUI code. Upon some interface event like clicking a button, you will call a function that retrieves the input from some fields on your form, gives them to an instance of StuffDoer, and calls whatever class functions you need to generate your results. If there were no problems, you update the form with the generated results, and you’re done. The details of how to do that depend on your GUI toolkit.

    Your GUI doesn’t need to know how DNA sequences are calculated, and your DNA sequencing module doesn’t need to know where the input comes from or how the output is displayed.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created some python code which creates an object in a loop, and
I have created a .NET DLL which makes some methods COM visible. One method
I have created a report in MS Access report and write some VBA code
I basically created some tables to play around with: I have Two main tables,
I'm trying to write some python code which can create multipart mime http requests
I have a custom c++ module for python that exposes functions, some of which
I have created some extra functionality on my Linq-to-SQL classes to make things easier
I have created some rounded navigation tabs using CSS and am having trouble when
I'm using SQL*Plus 9.2 on Oracle 10g enterprise. I have created some scripts that
I m new to use ankhSVN and having issues. I have created some new

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.