Page 1 of 3 123 LastLast
Results 1 to 10 of 22

Thread: Writing GUI app that can be ported to Windows

  1. #1
    Join Date
    Jun 2007
    Location
    Melbourne
    Beans
    65
    Distro
    Hardy Heron (Ubuntu Development)

    Writing GUI app that can be ported to Windows

    Hi,

    I need to write an application that can do some simple analysis of images for a friend of mine, it needs to be able to load a jpeg or whatever and report what colors the image is composed of and in what percentage, it's to estimate how much wool is needed to make tapestrys.

    Anyway it needs to be able to be ported to windows with a nice gui etc...

    I have not had much experience with glade or any gui stuff apart from my pre linux days with visual basic (argh). So any direction would be greatly apreciated about how to go about writing this program.

    Thanks in advance.
    Hello World!

  2. #2
    Join Date
    Feb 2007
    Beans
    236

    Re: Writing GUI app that can be ported to Windows

    See my replies in your other thread.

    As mentioned, use the C library functions in lieu of any Win32 API, or Linux "syscall". For example, if you need to open a file, don't use Win32's CreateFile(), nor Linux's open(). Use the C library's fopen(). If you need to allocate memory, don't use Win32's GlobalAlloc, nor Linux's mmap. Use the C library's malloc. Leverage the C library.

    I'll tell you right now that there is no Win32 API to load jpegs. Windows has a COM component (forget what it's called offhand, but its OlePicture() function loads a jpeg). COM coding is totally not portable to Linux. So what I'd do is look around and see if there's some simple open source jpeg reading library that is available for both Win32 and Linux, and use that.

    Keep your GUI code separate from your jpeg analyzation code, and it shouldn't be difficult to port the GUI. Some people will tell you to use cross-platform GUI stuff like wxWindows, but that stuff isn't installed by default on a Windows system. So, your friend will have to install it and set it up. And frankly, most of these big, complex cross-platform packages are a horror to install and setup on Win32. If it uses "environment variables" (and lots and lots of complicated Linux packages do), that is a particular annoyance for Windows users. Unlike Linux, Win32 environment variables are "per session" only, and not system-wide. Using environment variables on Win32 is a no-no. That is one of those deprecated things. Win32 has much better native means of doing what environment variables do. The only cross-platform stuff that really works well on Windows is the small, self-contained stuff (like a single DLL), packaged by someone who understands and has experience following Microsoft's guidelines for installation software.

    So if you go with the native Win32 GUI, at least you won't force him to deal with installing and setting up an entire, second graphical environment (which typically is designed first and foremost on Linux, and therefore doesn't leverage preferred ways of doing things on Win32, such as follow MS's installation guidelines).

  3. #3
    Join Date
    Jun 2007
    Location
    Melbourne
    Beans
    65
    Distro
    Hardy Heron (Ubuntu Development)

    Re: Writing GUI app that can be ported to Windows

    Thanks that was the information that I was looking for, so ill look for a portable library for a simple portable library to handle the jpegs.

    But with the GUI, are you saying that I will need to create a linux one with glade or whatever, and also make a windows one (is there free development software for doing this under windows).

    But I think I have enough to get me started, Thanks again
    Hello World!

  4. #4
    Join Date
    Nov 2006
    Location
    Israel
    Beans
    765
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: Writing GUI app that can be ported to Windows

    Somewhat contrary to j_g, if your goal is to whip out a usable gui application as fast as possible, I would recommend that you do use a cross-platform gui toolkit.

    I would recommend using python for most of the application, and if you need more 'speed' for a certain part use C (just for it). With python it can be very simple to develop an application with either GTK, wxWidgets (BTW - j_g, that is what it's called) or even Tkinter, which would work fine as long as you are doing something relatively simple. Tkinter also has the benefit of being included with Python, so your friend won't need to install anything else. There are also packages such as py2exe which would allow you to create an exe out of your python application so that it is the only thing that must be installed.
    Intel E6300 / MSI P4M890M / 2GB DDR2 677 / 80GB + 1TB SATA2 / GeForce 6200TC / DL DVD+-RW / Dell 24" U2410

  5. #5
    Join Date
    Jun 2007
    Location
    Melbourne
    Beans
    65
    Distro
    Hardy Heron (Ubuntu Development)

    Re: Writing GUI app that can be ported to Windows

    OK, i checked out some of j_g's other threads, mainly "glade to c++" and got a few more good pointers on writing good cross platform code.

    And smartbei, I will have a look into Tkinter, I haven't learnt much python yet, but it seems that it should be my next step to becoming the greatest programmer in the world so ill give it a shot.

    I don't want to start any wars between you champs about whether to create cross platform UI's or not, so Ill try smartbei's approach while keeping the back end separate from the UI, and if I run into to many problems in the porting Ill just rewrite the UI.

    Thanks again, and wish me luck
    Hello World!

  6. #6
    Join Date
    Aug 2006
    Beans
    134

    Re: Writing GUI app that can be ported to Windows

    I've only done a little bit but C++ and wxWidgets seems to work. In my case I go from MSVC to GCC in Linux.

    I do the app in MSVC using exclusively wx classes and functions; when it's working in windows and compiles with no warnings I copy the source to linux and recompile with gcc - you'll probably get some more warnings but once you fix those it's generally good to go.

    If your GUI is not overly complicated I would do it all in C++. Those GUI in one language, functions in another, installer in something else sound good on paper but aren't worth it in my experience.

    DB

  7. #7
    Join Date
    Jan 2006
    Beans
    Hidden!
    Distro
    Ubuntu 10.10 Maverick Meerkat

    Re: Writing GUI app that can be ported to Windows

    look into using SDL (platform independent) and any of GTK, QT4, WxWidgets
    I am infallible, you should know that by now.
    "My favorite language is call STAR. It's extremely concise. It has exactly one verb '*', which does exactly what I want at the moment." --Larry Wall
    (02:15:31 PM) ***TimToady and snake oil go way back...
    42 lines of Perl - SHI - Home Site

  8. #8
    Join Date
    Mar 2006
    Beans
    323
    Distro
    Ubuntu 6.10 Edgy

    Re: Writing GUI app that can be ported to Windows

    Or you could just use Java and don't have to worry too much.

    Python + glade + GTK works also, but then you need to package GTK for windows as well, since it is rarely installed by default.

  9. #9
    Join Date
    Feb 2007
    Beans
    236

    Re: Writing GUI app that can be ported to Windows

    Windows user: "G what? SDL??? I don't want that! I always use protection when I have sex. Java? Of course I know what that is. But I don't want it either. The last time I drank coffee, it spilled all over my keyboard and I had to buy a new one. Don't you have any software that just runs on my system like all the other stuff I use?".

    Note to humorless moderators: It's a joke.

  10. #10
    Join Date
    Jun 2007
    Location
    Melbourne
    Beans
    65
    Distro
    Hardy Heron (Ubuntu Development)

    Re: Writing GUI app that can be ported to Windows

    j_g, I here what you are saying, and I agree, so does this mean that python is out of the question as it is interpreted, or can it be compiled.

    Or should I stick to C/C++
    Hello World!

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •