LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-12-2014, 08:17 PM   #1
eatup
LQ Newbie
 
Registered: Apr 2014
Posts: 13

Rep: Reputation: Disabled
Create "Hello World" simple window application.


I already know how to printf a "hello world" program to the console. My next question is: How do I make this "hello world" a graphical program instead that has the min/max/close buttons at the upper right corner regardless of which GUI environment the Linux distro is using?
 
Old 04-12-2014, 08:44 PM   #2
BenCollver
Rogue Class
 
Registered: Sep 2006
Location: OR, USA
Distribution: Slackware64-15.0
Posts: 375
Blog Entries: 2

Rep: Reputation: 172Reputation: 172
Question

I remember XMMS and Auducity can do this. Somehow they tell X11 to omit the window decorations, and they draw their own close button instead. You might search on how to disable window decorations. I prefer to use the defaults for consistency with the user's desktop environment.
 
Old 04-12-2014, 09:32 PM   #3
eatup
LQ Newbie
 
Registered: Apr 2014
Posts: 13

Original Poster
Rep: Reputation: Disabled
I guess I should rephrase the question. My main goal is to create a window/form application that draws boxes/lines/texts/images and has a textbox for user input. I come from a Visual Studio background with knowledge of C# only. My knowledge of another programming language (and Linux) is very limited... (I just took a look at gtkmm and that stuff looks way too complicated for a newbie like me.)

Last edited by eatup; 04-12-2014 at 09:33 PM.
 
Old 04-12-2014, 10:01 PM   #4
BenCollver
Rogue Class
 
Registered: Sep 2006
Location: OR, USA
Distribution: Slackware64-15.0
Posts: 375
Blog Entries: 2

Rep: Reputation: 172Reputation: 172
Lightbulb

I'd recommend either Tk or Gtk.

Tk: http://www.tkdocs.com/tutorial/install.html#helloworld

Gtk: https://wiki.gnome.org/Projects/Vala/GTKSample

Possibly also of interest, Vala for CSharp programmers: https://wiki.gnome.org/Projects/Vala...arpProgrammers

Last edited by BenCollver; 04-12-2014 at 10:12 PM. Reason: add another link
 
Old 04-12-2014, 10:18 PM   #5
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Just to clarify. There is no single way of producing "a window" under Linux because there are multiple desktop environments. However, using one of the two that BenCollver should mean that anyone interested in your application could install and run it. Perhaps read a little more about Linux desktop environments and window managers.
Oh, I understand it is possible still to write pure X11 applications but I'm not sure how easy or desirable that is.
 
Old 04-12-2014, 11:08 PM   #6
eatup
LQ Newbie
 
Registered: Apr 2014
Posts: 13

Original Poster
Rep: Reputation: Disabled
delete

Last edited by eatup; 04-12-2014 at 11:31 PM.
 
Old 04-12-2014, 11:10 PM   #7
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Quote:
Originally Posted by eatup View Post
So help me understand another thing. I currently have a charting application written in .NET Framework. The problem is, it renders slow as heck in Windows 7 and 8, but lightning fast in XP.

So, can I reasonably assume drawing a bar chart + line chart combo with more than 1,000 data points that fills the entire screen will be "instantaneous" under Linux? (I would hate to embark on an application with 3000+ lines of code just to find out it performs no better in Linux than Windows 7 or 8.)
Without knowing exactly what you are doing nobody could say. However, Linux is not a panacea and while you could make it a lot faster under Linux if you know your stuff you could do the same under Windows.
 
Old 04-13-2014, 01:12 PM   #8
eatup
LQ Newbie
 
Registered: Apr 2014
Posts: 13

Original Poster
Rep: Reputation: Disabled
How do I install vala on a USB live distro?

Is there a simple sudo apt-get command to install the entire package?
 
Old 04-13-2014, 05:10 PM   #9
BenCollver
Rogue Class
 
Registered: Sep 2006
Location: OR, USA
Distribution: Slackware64-15.0
Posts: 375
Blog Entries: 2

Rep: Reputation: 172Reputation: 172
Installing Vala is not as simple as it ought to be. Below are links to instructions.

Ubuntu: https://help.ubuntu.com/community/Vala

Puppy: http://puppylinux.org/wikka/GenieProgramming
 
Old 04-13-2014, 05:37 PM   #10
metaschima
Senior Member
 
Registered: Dec 2013
Distribution: Slackware
Posts: 1,982

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Well, either you have to learn another language or you can install mono, which lets you program in C# under Linux. There's a program right here in C# to display a window:
http://www.mono-project.com/Mono_Basics

P.S.
Yes, I know mono is evil M$ software, but if all you know is C#, it'll have to do.
 
Old 04-13-2014, 06:55 PM   #11
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Germany
Distribution: Whatever fits the task best
Posts: 17,148
Blog Entries: 2

Rep: Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886Reputation: 4886
Unless you want to program specifically for the Gnome desktop environment I would not recommend to use Vala, since it is aimed at Gnome development.
Mono will be a viable way if you want to stay in the C# world, but it only has a not developed anymore implementation of Windows Forms 2.0 and there are no plans to implement the Windows Presentation Foundation.
Your best bet might be to use one of the GUI toolkits (like GTK or FLTk) or an application framework, like Qt. Many new projects tend to use Qt (and many older are switching), since platform independent programming is relatively easy with it and it has bindings to many program languages, for example PyQt and PySide for Python or QtSharp for C# (and other languages compatible with Mono/.Net).

Here is an example for a Hello World program using Python/PySide: http://qt-project.org/wiki/Hello_World_in_PySide
 
Old 04-13-2014, 08:26 PM   #12
BenCollver
Rogue Class
 
Registered: Sep 2006
Location: OR, USA
Distribution: Slackware64-15.0
Posts: 375
Blog Entries: 2

Rep: Reputation: 172Reputation: 172
A C# programmer might appreciate the C# syntax in Vala. Vala should be able to make programs that only require GTK and GObject, neither of which are tied to the Gnome desktop environment. http://www.linuxfromscratch.org/blfs...eral/vala.html

There are printed books about PyQt and I have read opinions that it is pleasant to use.
 
Old 04-14-2014, 04:57 PM   #13
eatup
LQ Newbie
 
Registered: Apr 2014
Posts: 13

Original Poster
Rep: Reputation: Disabled
^ True. Reason why I'm even considering vala is b/c .NET performance sucks in Win7/8. Evil M$ needs to optimize their run time... So, no C# in Linux for me, tyvm!
 
Old 04-14-2014, 04:59 PM   #14
eatup
LQ Newbie
 
Registered: Apr 2014
Posts: 13

Original Poster
Rep: Reputation: Disabled
My next question, if it so I happens I can't figure out how to install Vala in Linux, would it be feasible to develop Vala in Windows and compile the resultant C code in Linux, or must I install some other package for this to work?

Last edited by eatup; 04-14-2014 at 05:00 PM.
 
Old 04-14-2014, 05:02 PM   #15
eatup
LQ Newbie
 
Registered: Apr 2014
Posts: 13

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by TobiSGD View Post
Unless you want to program specifically for the Gnome desktop environment I would not recommend to use Vala, since it is aimed at Gnome development.
Mono will be a viable way if you want to stay in the C# world, but it only has a not developed anymore implementation of Windows Forms 2.0 and there are no plans to implement the Windows Presentation Foundation.
Your best bet might be to use one of the GUI toolkits (like GTK or FLTk) or an application framework, like Qt. Many new projects tend to use Qt (and many older are switching), since platform independent programming is relatively easy with it and it has bindings to many program languages, for example PyQt and PySide for Python or QtSharp for C# (and other languages compatible with Mono/.Net).

Here is an example for a Hello World program using Python/PySide: http://qt-project.org/wiki/Hello_World_in_PySide
I agree to what you're saying, but all I need is a simple window with a drawing area and a textbox. Anyways, is there something else better than vala for Linux newbiews that does not rely solely on Gnome?

Last edited by eatup; 04-14-2014 at 05:05 PM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] For a simple hello world module program, ".ko" file not created ! rdhanunjayaraju Linux - Kernel 2 07-04-2013 01:18 PM
[SOLVED] Valgrind reports memory leaks in very simple MPI "hello world" ejspeiro Programming 6 11-02-2012 11:35 AM
error in creating rpm package for a simple "Hello World" c program jayasekar Linux - Newbie 8 12-02-2009 12:53 AM
Error in Creating rpm package for a simple "Hello World" Program jayasekar Linux - Software 2 12-01-2009 08:26 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 11:37 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration